Undo a card in Solitaire (R0J0hound's example )

Get help using Construct 2

Post » Sun Jan 20, 2013 1:07 pm

I was figuring out how to make undo a card in solitaire game, @R0J0hound was genius to made .capx http://www.scirra.com/forum/solitaire-game-with-construct-2_topic60938_post374424.html#374424 , i was thinking to use webstorage to get each card values after of dropping a card and press a button to undo the dropped card, the problem is i couldn't find any help, i tried to experiment but it breaks the game.


Do you have better ideas?
B
96
S
25
G
20
Posts: 3,054
Reputation: 22,642

Post » Sun Jan 20, 2013 4:15 pm

With an undo you would want to save the state (position, variable values, etc...) that the card was before it was moved. The only issue that may come up in my example is with the positioning of stacks of cards, but there may be others.
B
79
S
24
G
54
Posts: 4,743
Reputation: 40,749

Post » Sun Jan 20, 2013 4:35 pm

You could create a different array each time a player does a move ... That's my 25 cents ...
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

Post » Mon Jan 21, 2013 1:27 am

@R0J0hound @Whiteclaws

Well, i'm quite confused because i'm not good to implement memento pattern, i've added Array object, then i made actions to set Card values on list 11.

The problem is this game is using local variables, i don't think i could copy these events to undo.

Do you think are you able to slove this .capx?

http://dl.dropbox.com/u/76227787/UnresolvedSolitaireUndo.capx
B
96
S
25
G
20
Posts: 3,054
Reputation: 22,642

Post » Mon Jan 21, 2013 10:21 pm

Isnt possible to make memento implementation for this game?
B
96
S
25
G
20
Posts: 3,054
Reputation: 22,642

Post » Tue Jan 22, 2013 3:54 am

Sometimes i bump this thread because i feel helpless, i apologize
B
96
S
25
G
20
Posts: 3,054
Reputation: 22,642


Return to How do I....?

Who is online

Users browsing this forum: zatyka and 21 guests