2012-07-16, 10:32 AM
inemnitable Wrote:Bosses with a maximum hp of 2^31 - 1 hasn't turned out so well, though.
It's turned out fine due to PDRate/MDRate.
Also, dealing with signed ints makes a lot of calculations easier.
Code:
//Using HP as a signed int
if(HP - DamageTaken <= 0)
{
PlayerDies();
}versus...
Code:
//Using HP as an unsigned int
if(HP - DamageTaken == 0 || HP - DamageTaken > HP)
{
PlayerDies();
}Having to deal with the fact that the variable could overflow makes the calculations more complicated and more prone to error.
