How to stop game score to 0 ?
Michi9298
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
Use an index attribute it only goes positive and stops at zero.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS
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.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
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.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Since he posted in the Mac thread, I'm assuming it's the Mac version but one never knows around here.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS