Added a main menu and fixed som things. added explotions to and fixed the economy
This commit is contained in:
parent
5bb373573d
commit
88771fad29
56 changed files with 1859 additions and 1999 deletions
|
|
@ -18,7 +18,7 @@ import ei.game.scene.units.Tank;
|
|||
* @author Ziver
|
||||
*
|
||||
*/
|
||||
public class InGameBuildHud {
|
||||
public class InGameBuildHud implements UiListener{
|
||||
private UiHandler ui;
|
||||
private Player player;
|
||||
private BitmapText queueSize;
|
||||
|
|
@ -33,14 +33,13 @@ public class InGameBuildHud {
|
|||
ui = new UiHandler("BuildMenu");
|
||||
|
||||
Vector2f size = new Vector2f(40,40);
|
||||
HudListener listener = new HudListener(this);
|
||||
|
||||
removeLastQueue = new Button("TankButton", size);
|
||||
queueSize = new BitmapText("QueueSize");
|
||||
queueSize.setText("0");
|
||||
removeLastQueue.setButtonSprite(queueSize);
|
||||
removeLastQueue.getNode().setLocation(new Vector2f(x,y));
|
||||
removeLastQueue.addListener(listener);
|
||||
removeLastQueue.addListener(this);
|
||||
ui.addUi(removeLastQueue);
|
||||
|
||||
apuBuildButton = new Button("TankButton", size);
|
||||
|
|
@ -51,7 +50,7 @@ public class InGameBuildHud {
|
|||
s2.setSize(size);
|
||||
apuBuildButton.setOnTopButtonSprite(s2);
|
||||
apuBuildButton.getNode().setLocation(new Vector2f(x+(size.getX()*2),y));
|
||||
apuBuildButton.addListener(listener);
|
||||
apuBuildButton.addListener(this);
|
||||
ui.addUi(apuBuildButton);
|
||||
|
||||
tankBuildButton = new Button("TankButton", size);
|
||||
|
|
@ -62,7 +61,7 @@ public class InGameBuildHud {
|
|||
s4.setSize(size);
|
||||
tankBuildButton.setOnTopButtonSprite(s4);
|
||||
tankBuildButton.getNode().setLocation(new Vector2f(x+(size.getX()*4),y));
|
||||
tankBuildButton.addListener(listener);
|
||||
tankBuildButton.addListener(this);
|
||||
ui.addUi(tankBuildButton);
|
||||
|
||||
bomberBuildButton = new Button("TankButton", size);
|
||||
|
|
@ -73,7 +72,7 @@ public class InGameBuildHud {
|
|||
s6.setSize(size);
|
||||
bomberBuildButton.setOnTopButtonSprite(s6);
|
||||
bomberBuildButton.getNode().setLocation(new Vector2f(x+(size.getX()*6),y));
|
||||
bomberBuildButton.addListener(listener);
|
||||
bomberBuildButton.addListener(this);
|
||||
ui.addUi(bomberBuildButton);
|
||||
}
|
||||
|
||||
|
|
@ -93,31 +92,23 @@ public class InGameBuildHud {
|
|||
return player;
|
||||
}
|
||||
|
||||
class HudListener implements UiListener{
|
||||
private InGameBuildHud hud;
|
||||
|
||||
public HudListener(InGameBuildHud h){
|
||||
hud = h;
|
||||
public void ActionEvent(UiComponent source){
|
||||
// builds a apu
|
||||
if(source == apuBuildButton){
|
||||
player.getCC().buildUnit(new APU(0,0,player));
|
||||
}
|
||||
// builds a tank
|
||||
else if(source == tankBuildButton){
|
||||
player.getCC().buildUnit(new Tank(0,0,player));
|
||||
}
|
||||
// builds a bomber
|
||||
else if(source == bomberBuildButton){
|
||||
player.getCC().buildUnit(new Bomber(0,0,player));
|
||||
}
|
||||
|
||||
public void ActionEvent(UiComponent source){
|
||||
// builds a apu
|
||||
if(source == hud.apuBuildButton){
|
||||
hud.getPlayer().getCC().buildUnit(new APU(0,0,player));
|
||||
}
|
||||
// builds a tank
|
||||
else if(source == hud.tankBuildButton){
|
||||
hud.getPlayer().getCC().buildUnit(new Tank(0,0,player));
|
||||
}
|
||||
// builds a bomber
|
||||
else if(source == hud.bomberBuildButton){
|
||||
hud.getPlayer().getCC().buildUnit(new Bomber(0,0,player));
|
||||
}
|
||||
|
||||
// removes the last unit in the queue
|
||||
else if(source == hud.removeLastQueue){
|
||||
hud.getPlayer().getCC().removeLast();
|
||||
}
|
||||
// removes the last unit in the queue
|
||||
else if(source == removeLastQueue){
|
||||
player.getCC().removeLast();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue