i need help with my scoring system

in my game i have a problem with the scoring. when i the man dies the score saves but when i click retry the game starts from the beginning but the score does not reset it keeps going from where it left off on the last run.

Comments

  • AdrenalineAdrenaline Member Posts: 523

    Wherever you have the code that restarts the rest of the game, add in a change attribute behavior that sets the score to 0

  • macman123macman123 Member Posts: 98

    @Adrenaline‌ thanks i will try that.

  • macman123macman123 Member Posts: 98

    @Adrenaline‌ i tried that but now when the game is over it just says 0 even if i scored more than that.

  • AdrenalineAdrenaline Member Posts: 523

    It sounds like you're resetting the score before you really want to. So delay setting it to 0 until after the Game Over screen. Move that change attribute behavior onto something else that REALLY resets your game. Like a Retry button or whatever you have at the Game Over screen for the user to try again.

  • JodyMitomaJodyMitoma Member Posts: 307

    You need the score changing attribute to display after you've saved the score somewhere.
    Are you trying to save the score for a highscore that will display?
    If not, then, simply have the score display in a new scene (GAME OVER or whatever other scene you choose), THEN reset score after that has been displayed.

  • macman123macman123 Member Posts: 98

    @Adrenaline‌ i put the change attribute at the retry button at the gameover screen so its like when i want it to be showing the score but not restarting with the same score

  • macman123macman123 Member Posts: 98

    @JodyMitoma‌ so youre saying make a new scene and have that scene display score?

  • JodyMitomaJodyMitoma Member Posts: 307
    edited May 2014

    No, not at all.

    If what you're telling me is that you want the score to display at the very end, when the player dies, or completes the level, you need to create a new scene, and display the score there. Of course you can still have the score display as the player is playing the game too. It can display at multiple areas without problem.

    What I'm saying is, you'll need to create the "Change attribute score to '0' " after the score has been displayed to the player, so, for example, put the "Change score back to zero" attribute on the "RETRY" button or "NEXT LEVEL" button.

    You get the idea?

  • AdrenalineAdrenaline Member Posts: 523

    @macman123‌ did you just put the change attribute on that retry button, or did you put it in a rule --- if touch?

    If you just put it on the button, it's going to fire and reset the score as soon as that actor is present in the scene. But what you really want is for the score to only reset when the Retry button is pressed, so put it in that "if touch" rule.

  • macman123macman123 Member Posts: 98

    @Adrenaline‌ i dint put it in a rule thats what i will do thanks.

  • macman123macman123 Member Posts: 98

    @JodyMitoma‌ i understand what youre saying now thanks.

  • macman123macman123 Member Posts: 98

    @Adrenaline‌ thanks it worked.

  • macman123macman123 Member Posts: 98

    @Adrenaline‌ one more thing though when i go out of the preview it doesnt save the highscore. do you have a solution to that? i thought i had fixed it but apparently it didnt save.

  • AdrenalineAdrenaline Member Posts: 523

    @macman123‌ I was in the middle of typing out a long explanation on how to save attributes, but then I realized it might be an even simpler solution.

    Are you using save attributes? If so, they're probably working fine. Testing in the GS Creator Preview area won't ever save the attribute when you go out of the preview. You'll need to test the app on a device to see this work correctly. Or you can also take note of when/if you change scenes, is the high score maintained?

  • macman123macman123 Member Posts: 98

    @Adrenaline‌ oh ok i do have save attribute and it does work when i change scene so it must work then. ok thanks.

  • AdrenalineAdrenaline Member Posts: 523

    Yep, you're good then

  • macman123macman123 Member Posts: 98

    yep, thanks for the help.

  • JodyMitomaJodyMitoma Member Posts: 307
    edited May 2014

    @Adrenaline said:
    macman123‌ I was in the middle of typing out a long explanation on how to save attributes, but then I realized it might be an even simpler solution.

    Are you using save attributes? If so, they're probably working fine. Testing in the GS Creator Preview area won't ever save the attribute when you go out of the preview. You'll need to test the app on a device to see this work correctly. Or you can also take note of when/if you change scenes, is the high score maintained?

    QUICK Question about Save Attribute & Tables on GS Preview vs. Published Device.
    I noticed that as I'm using tables, Save & Load tables seems to be working, even when I leave Preview. It'll continue to re-load the previews highscore & death count, up until I EXIT GS Creator. So, this will not happen in Published Devices then? Thanks man!

  • AdrenalineAdrenaline Member Posts: 523

    If I'm understanding correctly, it definitely should happen on the published devices as well. I'm not using tables in my current project so things may have changed recently, but I don't remember the save/load tables carrying over even after you exit a Preview in GS Creator. It was my understanding that every time you press Preview, it's as if it's the first time a device is running your app.

  • AdrenalineAdrenaline Member Posts: 523

    I should also note that I've always worked on a Mac…if that changes anything?

  • JodyMitomaJodyMitoma Member Posts: 307
    edited May 2014

    @Adrenaline said:
    If I'm understanding correctly, it definitely should happen on the published devices as well. I'm not using tables in my current project so things may have changed recently, but I don't remember the save/load tables carrying over even after you exit a Preview in GS Creator. It was my understanding that every time you press Preview, it's as if it's the first time a device is running your app.

    Strange. Might be different on the Windows version then, because my table values are definitely being kept alive up until I exit out of GameSalad completely, which of course, I do not mind! Leaving Preview, then making changes, then going back into Preview mode, table values are still as they were prior. Kind of shows me that it is working properly. :) Thanks!

Sign In or Register to comment.