Star system problem

Hi everyone!

I've come across a difficult problem (at least for me) while setting my score/star system, so therefore I'm writing my very first topic here. : )

So my platform hero is completing levels and also collecting lime fruits. After completing a lvl, on the level menu you can see how many fruits have you collected from that specific level. For example "2/4". After that you can try again till you got every fruit collected. Of course after completing a lvl, you can go straight to the next one no matter how many fruits you got.

The problem:

You start a level, collect 4 fruits but fail to finnish that level -> scene resets and you try again.

Now you get only 2 fruits but you finnish the level. A scene comes up where you can choose a next level, retry current or go to the Level Menu. If you now choose the Level menu, it shows in that level icon (that you just completed) 4/4 fruits collected, even though you only got 2 fruits in that turn you finished it.

I've watched GSHelper video tutorials, and learned from those to make this system as it is. But I'm afraid I've mixed something up.

So long story short, I do not want my game to keep score of unfinished turns.

If anyone can tell me how to fix this, I would be most gratefull! :)

Cheers.



Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    The scene reset behavior does not affect the values of game attributes. So if you are storing the number of collected fruits in a game attribute, you need to manually reset that value (Change Attribute game.collectedFruits to 0) right before resetting the scene.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • TurtleTonicTurtleTonic Member, PRO Posts: 6
    Thanks for quick answer. :)

    I have game attribute "score" that counts fruits. And if player hits wall, or falls, I've set attributes that change "score" to 0. And that is on top of Reset Scene attribute so it should trigger before scene resets?
  • Thunder_ChildThunder_Child Member Posts: 2,343
    Dang Im such a nerd....I thought this was going to be a thread about a space game. Lol
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    I have game attribute "score" that counts fruits. And if player hits wall, or falls, I've set attributes that change "score" to 0. And that is on top of Reset Scene attribute so it should trigger before scene resets?
    No. It needs to be a separate rule from the collision rule. You also have a rule that does a Reset Scene behavior. In that rule, you need to place a Change Attribute game.score to 0 behavior right above the Reset Scene behavior.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • TurtleTonicTurtleTonic Member, PRO Posts: 6
    Well that's what I meant to say.. So for example I have an actor called "Death" witch is on the bottom of the scene. I've made a rule inside "Death", that if player collides with it -> change score 0, and below that "Reset Scene" behavior, both inside a same rule.

    Same goes for "Wall" actor as well.
  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    Put the reset scene behavior in a timer with run to completion checked and set it to after .03 seconds. This will ensure the other attributes fire before the scene resets.
  • TurtleTonicTurtleTonic Member, PRO Posts: 6
    Put the reset scene behavior in a timer with run to completion checked and set it to after .03 seconds. This will ensure the other attributes fire before the scene resets.
    Thank you, but that did not work either.

    Anyway, I think I know now where the problem is. In every level I have actor called "Round Rules". In that actor I have my Save Table Scores, so it shows only the best ones in Level Menu. So somehow I need to make rule that it only does that Saving, when player completes level, rather than saving every turn...

Sign In or Register to comment.