Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
MBCook
26 days ago
|
parent
|
context
|
favorite
| on:
A time-travelling door bug in Half Life 2
I’m surprised to hear the ammo calculation code would use floats.
bakugo
26 days ago
[–]
The game has ammo pickups that refill 20% and 50% of whatever your max ammo is, so floats have to be involved in there somewhere.
manwe150
26 days ago
|
parent
[–]
Dividing by 5 or 2, respectively, are integers, if the game developers wanted them to be. More so because the actual units of ammo need to be integers if they are to render as full bullets each
shultays
25 days ago
|
root
|
parent
[–]
Or more generalized "ammo += (maxAmmo * percentageToFill) / 100"
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: