Added a hud for the money
This commit is contained in:
parent
287e6b3e50
commit
d1a2aa8b4e
13 changed files with 34 additions and 12 deletions
|
|
@ -4,6 +4,7 @@ import ei.engine.LWJGLGameWindow;
|
|||
import ei.engine.effects.BitmapText;
|
||||
import ei.engine.math.Vector2f;
|
||||
import ei.engine.scene.Node;
|
||||
import ei.engine.scene.Sprite;
|
||||
import ei.game.player.Player;
|
||||
|
||||
public class InGameHud {
|
||||
|
|
@ -16,14 +17,20 @@ public class InGameHud {
|
|||
|
||||
hudNode = new Node("Hud");
|
||||
|
||||
Sprite moneyBack = new Sprite("MoneyBackground","data/hud/money.png");
|
||||
moneyBack.setLocation(new Vector2f(
|
||||
LWJGLGameWindow.getWidth()-moneyBack.getSize().getX()/2,
|
||||
moneyBack.getSize().getY()/2));
|
||||
hudNode.add(moneyBack);
|
||||
|
||||
money = new BitmapText("MoneyMeter");
|
||||
money.setLocation(new Vector2f(LWJGLGameWindow.getWidth()-money.getBound().width,0));
|
||||
money.setLocation(new Vector2f(LWJGLGameWindow.getWidth()-money.getBound().width,5));
|
||||
hudNode.add(money);
|
||||
}
|
||||
|
||||
public void update(){
|
||||
money.setText(""+player.getKredits());
|
||||
money.setLocation(new Vector2f(LWJGLGameWindow.getWidth()-money.getBound().width,0));
|
||||
money.setLocation(new Vector2f(LWJGLGameWindow.getWidth()-money.getBound().width,5));
|
||||
|
||||
player.addKredits(100);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue