ResetGame in game initialization

fstltnafstltna Member Posts: 96
edited November -1 in Working with GS (Mac)
I want to create some code that gets called when the game is reset, where would I put this? I set a Boolean that says whether the game was being reset or not, but I don't know where to put the glue code to do the actual reset process...

Marisa

Comments

  • design219design219 Member Posts: 2,273
    I'm not sure I'm following exactly what your are asking, but there is a reset behavior and you could simply put a rule on any button graphic that when touched, reset game.

    http://gamesalad.com/wiki/behaviors_reference:reset_game

    Is this what you mean?

    _______________

    Nesen Probe http://itunes.apple.com/us/app/nesen-probe/id377766693?mt=8
    Tickle Stones http://itunes.apple.com/us/app/tickle-stones/id363484260?mt=8
    Food Fight! (free) http://itunes.apple.com/us/app/food-fight/id352646643?mt=8
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    remember that change attribute behaviors only fire once unless they are put in a timer. So you could create a blank actor (set to invisible) and just put a bunch of change attribute behaviors in it. Then just drop this in the scene that needs to be reset. Reset scene or game seems to only put actors back in their original spot - it does not reset attributes so you will have to reset them yourself every time. For me I do this a lot with level scores and level timers.
  • fstltnafstltna Member Posts: 96
    What I am trying to do is create a action that sets various things back to their original (game setup) state. I have all the code to reset what I want, but I need to know how I call this collection of code...

    Marisa
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Create a global boolean attribute called "pleaseResetNow".

    Then put your collection of code into a Rule, like this:

    Rule
    When all conditions are valid:
    game.pleaseResetNow = true
    -----Change Attribute game.pleaseResetNow To: false
    -----[collection of reset code goes here]

    Now, when something in the game triggers game.pleaseResetNow to be true, the code inside that Rule will execute.
  • fstltnafstltna Member Posts: 96
    Great - that was the missing component. Thanks a lot!

    Marisa
Sign In or Register to comment.