Added a hud for the money

This commit is contained in:
Ziver Koc 2007-04-23 19:33:27 +00:00
parent 287e6b3e50
commit d1a2aa8b4e
13 changed files with 34 additions and 12 deletions

View file

@ -9,12 +9,10 @@ import ei.engine.scene.Sprite;
import ei.engine.texture.Texture;
public class SelectBox {
private static final float height = 3;
private Node selectNode;
private Node mouseOverNode;
private ProgressBar bar;
private int max;
private float width;
private static final float height = 3;
/**
* Creates a selection box with health bar
@ -24,15 +22,13 @@ public class SelectBox {
* @param max The max health of the object
*/
public SelectBox(float x, float y, int max){
this.max = max;
this.width = x;
selectNode = new Node("SelectionNode");
mouseOverNode = new Node("MouseOverNode");
Texture tex = new Texture();
tex.setColor(new Vector4f(0.5f, 1.0f, 0.5f,1));
bar = new ProgressBar("Health",width,height,max);
bar = new ProgressBar("Health",x,height,max);
bar.getNode().setLocation(new Vector2f(0,-x/2+height/2));
selectNode.add(bar.getNode());
mouseOverNode.add(bar.getNode());

View file

@ -27,11 +27,18 @@ public class APU extends Unit{
this.sprite = new Sprite("APU", "data/units/apu/apu0000.png");
sprite.setSize(new Vector2f(40,40));
getNode().add(sprite);
gunSound = new Sound("gunSound", "data/sounds/machinegun.wav");
moveSound[0] = new Sound("moveSound", "data/sounds/APUmove1.wav");
moveSound[1] = new Sound("moveSound", "data/sounds/APUmove2.wav");
selectSound = new Sound("selectSound", "data/sounds/APUselect.wav");
attackSound = new Sound("attackSound", "data/sounds/APUattack.wav");
gunSound.setLocation(getNode().getLocation());
moveSound[0].setLocation(getNode().getLocation());
moveSound[1].setLocation(getNode().getLocation());
selectSound.setLocation(getNode().getLocation());
attackSound.setLocation(getNode().getLocation());
selectionBox = new SelectBox(40,40,getMaxLife());
}

View file

@ -27,12 +27,19 @@ public class Bomber extends Unit{
this.sprite = new Sprite("Bomber", "data/units/bomber/bomber0000.png");
sprite.setSize(new Vector2f(50,60));
getNode().add(sprite);
gunSound = new Sound("gunSound", "data/sounds/bomberweapon.wav");
moveSound[0] = new Sound("moveSound", "data/sounds/BOMBERmove1.wav");
moveSound[1] = new Sound("moveSound", "data/sounds/BOMBERmove2.wav");
selectSound = new Sound("selectSound", "data/sounds/BOMBERselect.wav");
attackSound = new Sound("attackSound", "data/sounds/BOMBERattack.wav");
gunSound.setLocation(getNode().getLocation());
moveSound[0].setLocation(getNode().getLocation());
moveSound[1].setLocation(getNode().getLocation());
selectSound.setLocation(getNode().getLocation());
attackSound.setLocation(getNode().getLocation());
selectionBox = new SelectBox(40,40,getMaxLife());
}

View file

@ -34,6 +34,12 @@ public class Tank extends Unit{
selectSound = new Sound("selectSound", "data/sounds/TANKselect.wav");
attackSound = new Sound("attackSound", "data/sounds/TANKattack.wav");
gunSound.setLocation(getNode().getLocation());
moveSound[0].setLocation(getNode().getLocation());
moveSound[1].setLocation(getNode().getLocation());
selectSound.setLocation(getNode().getLocation());
attackSound.setLocation(getNode().getLocation());
selectionBox = new SelectBox(40,40,getMaxLife());
}