using php can you make a code to replace any variable less then 0 with 0?

  • Thread starter Thread starter T G
  • Start date Start date
T

T G

Guest
heres the real question..

im writing a game and im having the problem with negative health if you get hit too hard..

i want it to be if you have less then 0 health replace with 0
 
I'm not real familiar with PHP, but I believe it would be something like this:

if ($health < 0) {
$health = 0;
}
 
Back
Top