How to stop game score to 0 ?

Michi9298Michi9298 Member, PRO Posts: 12

So basically im creating this game where if you tap squares your score increases by 1 point so on.And when you tap the triangles your score decreases by one point.

I want to know how to stop my score from going into -1,-2 etc when clicking the triangles and just to stop at 0.

(I hope that made sense :') ) I just want my score to stop decreasing from 0

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    Use an index attribute it only goes positive and stops at zero.

  • jamie_cjamie_c ImagineLabs.rocks Member, PRO Posts: 5,772

    If you're using the Windows version you don't have access to the Index Attributed I'm afraid. In that case you'd want to add a rule to your scorekeeping like:

    if score =< 0 then change score to 0

    That is simplified and not actual behaviors but hopefully you get the idea.

  • ArmellineArmelline Member, PRO Posts: 5,422

    If you've already got the attribute in use in a lot of places and don't want to replace it (though as @The_Gamesalad_Guru says, it's worth using an index if possible), you can also do this:

    max(0,game.Score)

    So if you're taking 1 away from the score, it would be:

    max(0,game.Score-1)

    etc.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited October 2014

    @jamie_c said:
    If you're using the Windows version you don't have access to the Index Attributed I'm afraid. In that case you'd want to add a rule to your scorekeeping like:

    if score =< 0 then change score to 0

    That is simplified and not actual behaviors but hopefully you get the idea.

    Since he posted in the Mac thread, I'm assuming it's the Mac version but one never knows around here. :#

Sign In or Register to comment.