resetting score after pressin pause and retry

app-etiteapp-etite Member Posts: 139
edited November -1 in Working with GS (Mac)
hi guys,

I have used gamesalads pause feature to pause my game, and on the pause screen i have a retry button.
When I press retry it reloads the scene ok but the score still remains. how can I also reset the score back to zero again?

Thanks

-appetite games

Comments

  • ApplaudAppsApplaudApps Member Posts: 308
    Just use change attribute to zero the score right before the change scene
  • app-etiteapp-etite Member Posts: 139
    Thanks buddy... I applaud you : )
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    I have to say with the load time between pause and un pause and the load time to reset a scene I would not recommend adding to the load time by combining the two.
  • app-etiteapp-etite Member Posts: 139
    what would you suggest otherwise tenrdrmer?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Either use a technique to reset the scene without the reset behavior. TSB and Darren both have some videos on this or just have a reset button on your scene.
  • ApplaudAppsApplaudApps Member Posts: 308
    You don't need to use unpause if you are using change scene (to refresh the scene) since the pause scene will be cleared from memory anyway, that will save some resources.

    But tenrdrmer is right in that if possible you should re-set the scene using other methods like recycling ... in which case you will need unpause (if you use pause to get to the reset button).

    So there might not be much in it
  • ApplaudAppsApplaudApps Member Posts: 308
    By the way I've got an instant retry button on my current game in development. This is how I did it.

    1. have an actor called something like levelgenerator
    2. in levelgenerator have it spawn all the scene actors on a trigger such as level1=true (if you dont have a problem with spawn)
    3. create a game attribute called reset
    4. make sure all actors (that levelgenerator spawns) have a rule that destroys them when reset=true
    5. when reset=true also change level1=false, then level1=true and the level will begin from scratch without any load times
    6. put your reset button on the scene along with the levelgenerator actor. when reset button touched then reset=true

    you will need to add some change attributes to clear scores etc on reset=true and dont forget to make reset=false before level1=true otherwise you'll get a blank screen!

    sorry that was typed quickly so hope it makes sense. This will save on scene changing. But there are other (probably better) methods. This works for me though
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    Spawning like that is gonna be hard on memory and the processor. The most common thing is in each actor have a startx and starty that changes to the current self positions when they load. that way you can set you reset button to change an attribute called game.reset to true and have all of the actors with rules when game.reset is true change attribute self positions to startx and starty. instead of destroying actors move them off scene or change their alphas to 0
  • ApplaudAppsApplaudApps Member Posts: 308
    That's the better method I alluded to ;-)
Sign In or Register to comment.