Technically, they should be unsigned, since they shouldn't be negative, however, I've seen lots of games use signed variables so I'm curious.
I know that using signed variables for HP is easier, but is that the only reason?
example if hp is unsigned: c if (enemy.dmg > player.hp) die(); player.hp -= enemy.dmg
example if hp is signed: c player.hp -= enemy.dmg if (player.hp < 0) die();
I also wonder if it has something to do with the fact that signed variables are the default type in all programming languages.
[link] [comments]






English (US) ·