reset to original values issue

kajutokajuto Member Posts: 314
edited February 2012 in Working with GS (Mac)
Hi there, if something like game.coinCollected or health bar, i need to be reset to their original values. The easiest way is to have an actor that initiates those variables on level start. how can i do that ??explain step by step please i appreciate it

Comments

  • robert.mccarthyrobert.mccarthy Member Posts: 165
    Hi Kajuto,

    1. Have a global variable (integer) 'coinCollectedStartValue' (or something like that)
    2. Set that global variable (integer) to what ever value you want to start with
    3. As you run through your game, and the original 'coinCollected' is reduced.
    4. When you reset your level (through game over) or you start a level, changeAttribute 'coinCollected' to 'coinCollectedStartValue'

    Basically, you have a permenant store of the value you want as a global variable, and when you want (level end, reset etc) you then change your ingame counter/score etc back to that permenantly stored global variable.

    Hope this helps, PM me if you need help further.
  • kajutokajuto Member Posts: 314
    for example when u mentioned #2 ... can you use i have a "coin collected" make a example with the value and all that..please

    thanks
Sign In or Register to comment.