This commit is contained in:
parent
98cd3b8287
commit
0bfc621ade
6 changed files with 32 additions and 20 deletions
|
|
@ -31,6 +31,7 @@ public abstract class GameEntity{
|
|||
if(life > max_life){
|
||||
max_life = life;
|
||||
}
|
||||
if(getSelection() != null)getSelection().setValue(l);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -64,6 +64,17 @@ public class SelectBox {
|
|||
* @param v The value of the health bar
|
||||
*/
|
||||
public void setValue(int v){
|
||||
value.setSize(new Vector2f((v/max)*width,height));
|
||||
value.setSize(new Vector2f(((float)v/max)*width,height));//(v/max)*width
|
||||
value.setLocation(new Vector2f(-width/2+(((float)v/max)*width)/2,-width/2+height/2));
|
||||
|
||||
if(((float)v/max) < 0.15f){
|
||||
value.getTexture().setColor(new Vector4f(1.0f, 0f, 0f, 0.6f));
|
||||
}
|
||||
else if(((float)v/max) < 0.50f){
|
||||
value.getTexture().setColor(new Vector4f(1.0f, .95f, 0, 0.6f));
|
||||
}
|
||||
else{
|
||||
value.getTexture().setColor(new Vector4f(0.3f, 1.0f, 0.3f, 0.6f));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -97,17 +97,13 @@ public abstract class Unit extends GameEntity{
|
|||
* Updating the unit
|
||||
*/
|
||||
public void update() {
|
||||
getSelection().setValue(getLife());
|
||||
|
||||
if(moveTo != null) {
|
||||
Vector2i moveVect = new Vector2i((int)moveTo.getX(),(int)moveTo.getY());
|
||||
//Vector2i currentVect = new Vector2i((int)unitNode.getLocation().getX(), (int)unitNode.getLocation().getY());
|
||||
|
||||
|
||||
int moveXminus = moveVect.getX()-oldVect.getX();
|
||||
int moveYminus = moveVect.getY()-oldVect.getY();
|
||||
System.out.println("moveVect: "+moveVect);
|
||||
//System.out.println("currentVect: "+currentVect);
|
||||
|
||||
float divideY = (moveVect.getY()+1)/(oldVect.getY()+1);
|
||||
float divideX = (moveVect.getX()+1)/(oldVect.getX()+1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue