How do I make the score reset when the player loses the game.

ashapiro914ashapiro914 Member Posts: 88
edited November -1 in Working with GS (Mac)
Hi, I am making a game and I have a score attribute set up. I have a problem though, when you lose the game I need the score to reset back to 0. I havent found any posts or videos on how to do this. Any help would be apprecited.
Thanks,
Aaron

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi Aaron; presumably you've got a boolean attribute for when the game is still running compared to when the game is lost. So let's call this boolean attribute GameLose set to its default false.

    Your attribute for the score is an integer attribute, I guess. let's call this Score

    Rule
    When GameLose is false

    When such and such happens in your game (whatever rule(s) you already have)
    Change attribute Score to Score+10 -------or whatever added number you have

    Otherwise

    change attribute Score to 0
    change attribute GameLose to false

    Reset scene

    That's basically it; hope you get it sorted.

    ---------------------------------------------
    http://www.davidgriffinapps.co.uk/

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • ashapiro914ashapiro914 Member Posts: 88
    I don't quiet understand.
  • Asobu_GamesAsobu_Games PRO Posts: 261
    Essentially you just have to make a rule so that when the game is lost change the score attribute to 0. What attribute do you have in place to tell when the game is lost? Do you have lives? If so then an example could be Rule: When Lives = 0, change attribute (score) to 0.
  • ashapiro914ashapiro914 Member Posts: 88
    I have the score going by a timer. Something like 1point every second.
  • ashapiro914ashapiro914 Member Posts: 88
    I have a tree and a few other things to dodge. The lose settings are, when actor collides with car change scene to lose.
  • Asobu_GamesAsobu_Games PRO Posts: 261
    Ok, so you could make more rules for the collision event:

    When actor collides with car > change timer to 0 AND change score to 0 AND THEN change scene to 'lose'. You would also need to make it so the score only goes up when 'lose' = false, otherwise it will keep adding to the score on the lose scene.
Sign In or Register to comment.