Added health bar
This commit is contained in:
parent
f7c3a895f0
commit
adbfa34350
4 changed files with 113 additions and 26 deletions
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue