Spritekit undo move

Discussion in 'Public Game Developers Forum' started by Prashant, Jun 21, 2014.

  1. Prashant

    Prashant New Member

    Jun 21, 2014
    2
    0
    0
    Anyone familiar with spritekit?
    Can some one tell me how we can keep a track of user moves? And how to add an undo move feature in spritekit?

    Been looking all over the internet for this but no luck.
     
  2. Voley

    Voley Well-Known Member

    Aug 23, 2010
    58
    0
    0
    Check out gameprogrammingpatterns.com - very useful book.
    You need a "Command" design pattern.
    Basically you create an object for every move and send it to your control code. Each command can also have equivalent undo object as either field in itself, or a separate object.

    So this way when you want to undo you just tell your control code to execute undo on last command.
     

Share This Page