Added health bar

This commit is contained in:
Ziver Koc 2007-04-17 12:51:26 +00:00
parent f7c3a895f0
commit adbfa34350
4 changed files with 113 additions and 26 deletions

View file

@ -45,10 +45,10 @@ public abstract class Unit extends GameEntity{
public void setSelected(boolean b) {
super.setSelected(b);
if(b) {
unitNode.add(getSelection());
unitNode.add(getSelection().getNode());
}
else{
unitNode.remove(getSelection());
unitNode.remove(getSelection().getNode());
}
}
@ -94,6 +94,8 @@ public abstract class Unit extends GameEntity{
* Updating the unit
*/
public void update() {
getSelection().setValue(getLife());
if(moveTo != null) {
Vector2i moveVect = Map.getPosByPixel(moveTo.getX(), moveTo.getY());
Vector2i currentVect = Map.getPosByPixel(unitNode.getLocation().getX(), unitNode.getLocation().getY());