1 Attachment(s)
Creating an Undo Command for Sokoban
Hey guys
I am creating a sokoban type game and I am trying to work out a way to create an undo command. I would like to be able to have infinite 'Undo's, just like in my puzzle script games.
In my head I can think of the logic. The positions of various objects need to be stored somewhere, probably an array. But I am not very good with loops or arrays - I've never really used either much. So the hardest thing will be not only working out how to do 'Undo' for a single object, but how to do it for multiple objects.
I have attached the MFA that contains the logic of what I'm working on. Can someone please help me achieve the following:
- An Undo command for each level
- Make it so that every time you press 'Z', it reverses the last move you did, moving the player and anything the player moved back 1 turn
- Make it so that multiple objects can be automatically stored and 'Undone' so that I could add as many instances of the crates as I like, and they can all respond to 'Undo'
- Please explain to me the process so that I can do it again myself in the future. I'm not so good at understanding examples, I need a bit of an explanation
- Please explain how you used any loops, arrays or processes
Here is the file: Attachment 14844
Please let me know if I can explain things any clearer.
Thank you in advance for your time and help
Simflare