if z > top_card_z
top_card_z = z
update_pile_views() # ensures instantiation of all visible cards
- if state.cards[card].view? # the card is visible
+ if @cards[card].view? # the card is visible
# show it face down if it's in the other player's hand
- state.cards[card].view.toggleClass 'your_hand', in_your_hand state.cards[card]
+ @cards[card].view.toggleClass 'your_hand', in_your_hand @cards[card]
if agent is me
tell_server ['move', agent, card, x, y, z, pile]
else
- if state.cards[card].view?
- state.cards[card].view.css "z-index": z
- state.cards[card].view.animate { left: "#{transform_x x}px", top: "#{transform_y y}px"}, 800
+ if @cards[card].view?
+ @cards[card].view.css "z-index": z
+ @cards[card].view.animate { left: "#{transform_x x}px", top: "#{transform_y y}px"}, 800
state.on 'mark', (agent, card, state) ->
- if state.cards[card].view?
+ if @cards[card].view?
@cards[card].view.toggleClass 'marked', state
if agent is me
tell_server ['mark', agent, card, state]
state.on 'flip', (agent, card, state) ->
- if state.cards[card].view?
+ if @cards[card].view?
@cards[card].view.toggleClass 'flipped', state
if agent is me
tell_server ['flip', agent, card, state]