Issue in managing an Array in order to do an undo mechanic

From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • Hello,

    i would like to make a very simple undo mechanic on my game.

    The mechanic is to save the last save on the array when the button "X" is triggered , then load the last save (from the front) of the array when the button "L" is triggered and then delete the last entry of the array (from the front)

    Like this i imagined that the player can save several times and used these saves to "undo" (for the player, it will look like an undo) his last moves.

    All works EXCEPT the delete of the last entry in the array, i don't know why but when i load the game the last entry stay...So the player can only load the last save and not all previous ones...

    I assumed that it was cause the game was already loaded so the array is loaded too and have all the variables that it contained before the loading but i'm not sure and even if it's the cause, i don't have any solution since i have tried several times to figure out this point.

    Below some screenshot of my code, it is simple but you can ask me some questions if needed.

    Thank you by advance for help

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Up...If somoene have a clue or some Idea to Help, don't hesitate

  • I don't know what can be the problem in your project, there is not enough information. I'm guessing the reason is that the undo array is also saved/loaded.

    You can check this demo I made for an Undo system, it shows how to work around this issue:

    howtoconstructdemos.com/comprehensive-undo-redo-system-capx

  • Thank you buddy, i will take a look

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)