Game Development Community

Numeric Health Indicator

by Chris Byars · in Torque Game Engine · 03/02/2006 (4:53 pm) · 1 replies

A minor issue with this ancient resource.

Anyone know of a way to make the %value only be an integer? No decimal places or anything. Currently since my health gradually regenerates, it will go from 30 to 29.25 and things like that. I don't want a decimal, heh.

Edit: How could I have forgotten the almighty search button.

This works:

function clientCmdSetHealthAmountHud(%value)
{
   if ((%value-mFloor(%value)) < 0.5)
   {
   %ret = mFloor(%value);
   }
   else
   {
   %ret = mCeil(%value);
   }

   HealthAmount.setText(%ret);
}