How can I get the score to not reset (back to 0) when going to the next level?

DarDar Member Posts: 37
edited November -1 in Working with GS (Mac)
I set up a score system, how can I set it so that when I continue to the next level it doesn't reset back to 0? So for example, lets say I score 100 points on the 1st level and I completed it, so I go onto the next level, but the score is back to 0. How can I make it remember the score?

And I how can I set it so it remembers the highest score that that person has ever done? So for example, Let say the player gets 300 (his highest score so far) on the 2nd level then exits the game (I want my game to automatically save his score). Then the next time he plays it he sees his highest score (300) and then when he get higher than that, the 300 automatically erases and is replaced with his new high score. How can I do this?

Thanks guys!

Comments

  • MightyBooshMightyBoosh Member Posts: 83
    Hey Dar. I am also facing a similar issue. If you search "game salad high score" in youtube there is a video by tollhouse studio which explains a bit. It may be of help
    But hopefully someone gives a better answer because I'm stuck as well
  • RHRH Member Posts: 1,079
    For your score, are you using a global attribute or a scene attribute (or even one on your actor)?

    And do you have different scenes for each level?
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Yeah I would have thought a global attribute wouldn't reset unless you told it to... I'll keep watching this thread though as I'll need to know this soon, too ;)
  • peachpellenpeachpellen Member Posts: 977
    Well, more than one person beat me to the punch - but you aren't using a global attribute; or if you are you've done something very weird elsewhere :P So when you change that, it will fix it.

    As to the highscore, in your game over/complete scene have a rule like this;

    (Be sure to create two integers first; one called score, one called highscore.)

    Rule
    If game.score > game.highscore
    Change game.highscore to game.score

    (use save attribute)
    Save game.highscore as XXX (XXX would usually be "highscore")

    Then on your main screen, or wherever you want the high score to show up, you do;
    Load attribute - highscore

    Then do something like "display text: "game.highscore".

    Hope that helps.
  • DarDar Member Posts: 37
    I don't think I have used global attribute, I followed the instructions on game salad wiki. To create an integer called game score. Then make a new actor called game score display and set it to display text of the game score. Then on my main actor (the one being controlled by a player) set it so:

    When actor ovelaps or collides with .....
    Change attribute: game.Game score to (copy and paste then +20) game.Game score +20.

    So every time it adds 20 to the score.

    Ok I will try what peachpellen said and let you know thank you!
  • DarDar Member Posts: 37
    Umm, where do do the "If game.score > game.highscore..."? Do I do it on an actor? If I do then I must of had done something wrong because it didn't work. Thanks
  • AfterBurnettAfterBurnett Member Posts: 3,474
    You need to use a global attribute or it will reset when you leave the scene.
  • DarDar Member Posts: 37
    yes, but what is a global attribute, sorry I'm quite new...

    Thanks
  • AfterBurnettAfterBurnett Member Posts: 3,474
    Okay, you'll have something like player.score (or whatever you named it) to track the score. You probably created a local attribute (for the actor) rather than making a global attribute for the entire game... I'm not very good at explaining this stuff but it's all there in the wiki :)
  • DarDar Member Posts: 37
    Ok thanks I have figured out the high score thing, but, I still haven't figured out the reseting problem on the level, however I have done the rule:

    When atrritute game.score < infinti (so less than anything)

    Save attribute.

    But I still need to figure out how to set it back to 0 when the "you lose" or "you win" scene comes up.

    Any ideas?
  • RHRH Member Posts: 1,079
    To automatically change the score to 0 instantly in the 'you win' / 'you lose' scene just create an actor and add a rule that changes game.score to 0.

    If you want to display the final score or something on the 'you win/lose' scene you could have buttons like 'retry' 'next level' or 'menu' and just put a rule on each of them that when touched change attribute game.score to 0.
  • DarDar Member Posts: 37
    ahh! Thank you so much!
Sign In or Register to comment.