Resetting the table in my game?

I'm trying to make levels, so I want a try again button and a next level button to come up on the screen when the player loses.

I made the try again button be a reset scene button, and the scene resets when it's pressed but the table doesn't.

I tried changing all the attributes back to 0 and the rows/columns back to the original number when the try again button is pressed but it still didn't work.

Does anyone know of a way to reset my table when I reset the scene?



Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    The best thing to do is to copy the table you're using in your rules at the beginning of the game so that you have a backup table. Then when you want to reset the table, just copy the backup to the "in use" table.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • colandercolander Member Posts: 1,610
    I have a combined replay and next button in my game with a combination of rules to determine if the level has to be replayed or go to next level.

    I adjust my score attribute in replay and save it to a table and then reset the scene. On all my scenes I have a "Load Scene Attributes" actor of screen which sets all my attributes either hard coded or from a table. It is the last actor in the Layers tree so it is the first to load when a scene starts. It sets the score from the table again which is unnecessary in this case but it ties in with my save game routine incase a player quits instead of replaying the level and for other modes of play.

    "Load Scene Attributes" actor also has a self attribute integer for each scene which can be used as a table row or column number if needed for each individual scene. This makes it very flexible and I don't need a different actor for each scene.

    Someone here suggested putting a basic set of self attributes in each actor they create. This is because GS currently won't let you add one and have it available to all instances already on scenes. This is not so bad if you only have a handful of instances to redo but a real pain if you have a hundred of them.
  • CointossCointoss Member Posts: 31
    thank you both! I figured it out! :)
Sign In or Register to comment.