This site requires JavaScript, please enable it in your browser!
Greenfoot back
ironphoenix20
ironphoenix20 wrote ...

2017/3/25

HealthBar creation

1
2
3
ironphoenix20 ironphoenix20

2017/3/27

#
you mean i should take in a parameter for damage in the update method and change the values and image accordingly?
danpost danpost

2017/3/27

#
ironphoenix20 wrote...
you mean i should take in a parameter for damage in the update method and change the values and image accordingly?
That is about right (if not spot on). The parameter does not necessarily have to be for damage only -- it can also be for healing as well. Using a method signature of 'public void adjustHealth(int amount)', a negative parameter value would be for damage and a positive one would be for healing. Just adjust the health value and call a private method to update the image.
You need to login to post a reply.
1
2
3