What is it?
This project provides a method of implementing a rewind effect in a game, popularised by games such as Braid.
All actions in the scene (including player/enemy movement, deaths, projectile release/movement) are encapsulated as actionable command objects. The base Command class is shown below.
Each command has an execute and undo method. For example, implementation of a simple movement command.
When a command is generated it is added to a global group containing all commands executed.
This group simply encapsulates a list and provides access to a Reverse method (important in undoing the performed actions).
To reverse the scene (and begin the rewind effect), you simply iterate through the command group in reverse order and execute the commands undo methods.
Thank you for reading 🙂