Decrease a variable

Non-platform specific questions.

Decrease a variable

Postby littlekruser » Thu Apr 12, 2007 9:29 am

I'd like to decrease a variable by 1 until it reaches zero. The var is called "hunger" and is used for people in my game. I want it to be set to 100 and then decrease at a steady rate down to 0. I've tried as many ways as I can think of, so any help would be much appreciated!
littlekruser
 
Posts: 15
Joined: Wed Apr 11, 2007 6:22 am
Score: 0 Give a positive score

Postby makslane » Thu Apr 12, 2007 1:05 pm

Code: Select all
hunger = hunger - 1;


or

Code: Select all
hunger -= 1;


or

Code: Select all
hunger--;
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest