Master Reset

Hi,

I am trying to make a master reset button the resets my game when pressed. I am storing my information in tables ( position, coins, weapons etc.) I added in a button that resets the game but it will not rest my table data.

My change attributes for my table is on my splash screen along with my reset button. Any ideas how to rest the tables.

Comments

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    The Reset Game Behavior will reset the game and attributes back to their initial state as though the game were launched from the device BUT it will not re-set data in a table. If you want to clear out or reset a table you'll need to do that manually. Usually I'll make two tables for a set of data. One that holds the default information and one that is used to save and load from. Then if you ever want to reset the save/load table you can copy the default table into it using a Copy Table Behavior.

  • quinn221quinn221 Member Posts: 280

    @jamie_c thanks...but I am still a bit fuzzy on it, do you have any examples? And how would you reset a saved attribute

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    I'm afraid I don't have any tutorials or samples.

    1. Imagine you have a table called Data that has only one column named Health and the default value is 100.
    2. Make two copies of this table, one named DataDefaults and one named Data
    3. During the game save and load the Health Attribute from the Data Table.
    4. When you want to reset the contents of the table named Data use a Copy Table Behavior to replace the contents of the Data table with the contents of the DataDefualts table.

    I don't know what you mean by 'reset a saved attribute' can you explain?

  • quinn221quinn221 Member Posts: 280

    Thanks Jamie I will give it a try. I have one saved attribute in the game that unlocks levels (based off of a video I watched). Just trying figure out how I reset this this as well when the user resets the game.

  • quinn221quinn221 Member Posts: 280

    @jamie_c OK, I have the reset almost working.... But when I reset using the Defaults my main player comes in at the bottom of the screen

  • quinn221quinn221 Member Posts: 280

    @jamie_c I have been trying different approaches all night still not luck with getting the player to appear back to the correct start position after reset.

    Can you take a quick look at my rules. see attached

    checkpoint-table.png - this is my saved table data when the hero crosses checkpoints

    checkpoint-table reset.png - this is the table that is used to replace the checkpoint table on the reset.

    splash-screen reset.png this is a screen shot of my splash screen rules.

    Everything works on the reset except for the position when reloading the game, it is almost like it just does not know where to place the actor on the next scene

    Not sure where to go from here

    https://www.dropbox.com/s/gaizev0ysqfr75u/Archive.zip?dl=0

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    I'm on my iPad at the moment so I can't get that zip file. But if your player is not in the correct position when the level begins for whatever reason you can manually set that if you have to with Change Attribute Behaviors for its X and Y locations.

  • quinn221quinn221 Member Posts: 280

    Thanks Jamie!

Sign In or Register to comment.