mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
* bugs fixes
git-svn-id: file:///home/shlomif/Backup/svn-dumps/PySolFC/svnsync-repos/pysolfc/PySolFC/trunk@134 efabe8c0-fbe8-4139-b769-b5e6d273206e
This commit is contained in:
parent
d4edb60a90
commit
7802048ce5
3 changed files with 32 additions and 14 deletions
|
@ -997,14 +997,14 @@ class Game:
|
|||
while i < frames:
|
||||
mx, my = int(round(dx * i)) - tx, int(round(dy * i)) - ty
|
||||
tx, ty = tx + mx, ty + my
|
||||
for s in shadows:
|
||||
s.move(mx, my)
|
||||
for card in cards:
|
||||
card.moveBy(mx, my)
|
||||
if i == 1 and shadow and from_stack:
|
||||
# create shadows in the first frame
|
||||
sx, sy = self.app.images.SHADOW_XOFFSET, self.app.images.SHADOW_YOFFSET
|
||||
shadows = from_stack.createShadows(cards, sx, sy)
|
||||
for s in shadows:
|
||||
s.move(mx, my)
|
||||
for card in cards:
|
||||
card.moveBy(mx, my)
|
||||
self.canvas.update_idletasks()
|
||||
step = 1
|
||||
if clock:
|
||||
|
|
|
@ -82,14 +82,13 @@ class AMoveMove(AtomicMove):
|
|||
def __doMove(self, game, ncards, from_stack, to_stack):
|
||||
if game.moves.state == game.S_PLAY:
|
||||
assert to_stack.acceptsCards(from_stack, from_stack.cards[-ncards:])
|
||||
cards = []
|
||||
for i in range(ncards):
|
||||
card = from_stack.removeCard()
|
||||
cards.append(card)
|
||||
cards.reverse()
|
||||
cards = from_stack.cards[-ncards:]
|
||||
if self.frames != 0:
|
||||
x, y = to_stack.getPositionFor(cards[0])
|
||||
game.animatedMoveTo(from_stack, to_stack, cards, x, y, frames=self.frames, shadow=self.shadow)
|
||||
x, y = to_stack.getPositionForNextCard()
|
||||
game.animatedMoveTo(from_stack, to_stack, cards, x, y,
|
||||
frames=self.frames, shadow=self.shadow)
|
||||
for i in range(ncards):
|
||||
from_stack.removeCard()
|
||||
for c in cards:
|
||||
to_stack.addCard(c)
|
||||
|
||||
|
|
|
@ -702,14 +702,14 @@ class Stack:
|
|||
|
||||
def getPositionFor(self, card):
|
||||
model, view = self, self
|
||||
if view.can_hide_cards:
|
||||
return view.x, view.y
|
||||
x, y = view.x, view.y
|
||||
if view.can_hide_cards:
|
||||
return x, y
|
||||
ix, iy, lx, ly = 0, 0, len(view.CARD_XOFFSET), len(view.CARD_YOFFSET)
|
||||
d = self.shrink_face_down
|
||||
for c in model.cards:
|
||||
if c is card:
|
||||
break
|
||||
d = self.shrink_face_down
|
||||
if c.face_up:
|
||||
x += self.CARD_XOFFSET[ix]
|
||||
y += self.CARD_YOFFSET[iy]
|
||||
|
@ -718,7 +718,26 @@ class Stack:
|
|||
y += int(self.CARD_YOFFSET[iy]/d)
|
||||
ix = (ix + 1) % lx
|
||||
iy = (iy + 1) % ly
|
||||
return (x, y)
|
||||
|
||||
def getPositionForNextCard(self):
|
||||
model, view = self, self
|
||||
x, y = view.x, view.y
|
||||
if view.can_hide_cards:
|
||||
return x, y
|
||||
if not self.cards:
|
||||
return x, y
|
||||
ix, iy, lx, ly = 0, 0, len(view.CARD_XOFFSET), len(view.CARD_YOFFSET)
|
||||
d = self.shrink_face_down
|
||||
for c in model.cards:
|
||||
if c.face_up:
|
||||
x += self.CARD_XOFFSET[ix]
|
||||
y += self.CARD_YOFFSET[iy]
|
||||
else:
|
||||
x += int(self.CARD_XOFFSET[ix]/d)
|
||||
y += int(self.CARD_YOFFSET[iy]/d)
|
||||
ix = (ix + 1) % lx
|
||||
iy = (iy + 1) % ly
|
||||
return (x, y)
|
||||
|
||||
def getOffsetFor(self, card):
|
||||
|
|
Loading…
Add table
Reference in a new issue