Page 1 of 1

score

PostPosted: Fri Feb 15, 2008 3:38 pm
by j2graves
In my game, when you get hurt and lose coins, the score decreases by 10. if the score is less than 10, it will become negative numbers. how can I make it stop at zero?

Re: score

PostPosted: Fri Feb 15, 2008 3:47 pm
by edh
You could do something like

Code: Select all
number -= penalty;
if (number < 0) { number = 0; }
textNumber = number;


also, take a look at this thread http://game-editor.com/forum/viewtopic.php?f=2&t=4790

Re: score

PostPosted: Fri Feb 15, 2008 6:23 pm
by Kalladdolf
or if you want it to stay the current number, when it's about to become minus:
Code: Select all
if(number>0)
{//lose}

Re: score

PostPosted: Sat Feb 16, 2008 2:01 am
by Bee-Ant
j2graves wrote:In my game, when you get hurt and lose coins, the score decreases by 10. if the score is less than 10, it will become negative numbers. how can I make it stop at zero?

Code: Select all
if(score<=0)
{
    score=0;
}

Re: score

PostPosted: Sat Feb 16, 2008 9:44 am
by j2graves
thanx!