score

Non-platform specific questions.

score

Postby j2graves » Fri Feb 15, 2008 3:38 pm

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?
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: score

Postby edh » Fri Feb 15, 2008 3:47 pm

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
User avatar
edh
 
Posts: 233
Joined: Thu Sep 13, 2007 12:17 am
Location: Maine, USA
Score: 14 Give a positive score

Re: score

Postby Kalladdolf » Fri Feb 15, 2008 6:23 pm

or if you want it to stay the current number, when it's about to become minus:
Code: Select all
if(number>0)
{//lose}
User avatar
Kalladdolf
 
Posts: 2427
Joined: Sat Sep 08, 2007 8:22 am
Location: Germany
Score: 120 Give a positive score

Re: score

Postby Bee-Ant » Sat Feb 16, 2008 2:01 am

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;
}
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: score

Postby j2graves » Sat Feb 16, 2008 9:44 am

thanx!
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron