Timeline for how to set up health bar rect that depends on health?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 25, 2015 at 21:57 | vote | accept | user1924249 | ||
Oct 25, 2015 at 21:51 | comment | added | user1924249 | i found the issue. the algorthim is this: (enemyWidth * enemyCurrentHealth) / enemyMaxHealth; | |
Oct 25, 2015 at 21:31 | comment | added | KevLoughrey |
You can cast a float value to an int. You have to do it like this in Java: int myInt = (int)(Math.round(floatValue)); Source.
|
|
Oct 25, 2015 at 21:23 | comment | added | user1924249 | great thanks. I only problem that fillRect only takes int. is there way I can work around it? | |
Oct 25, 2015 at 20:35 | history | answered | KevLoughrey | CC BY-SA 3.0 |