This commit is contained in:
Jesper Lundin 2007-04-23 16:25:27 +00:00
parent e1c0fa7a48
commit 7e309db351
9 changed files with 16 additions and 18 deletions

Binary file not shown.

View file

@ -30,13 +30,13 @@ public class InGameState extends GameState{
HumanPlayer player = new HumanPlayer();
Tank t1 = new Tank(player);
t1.setLife(10);
player.addUnit(t1);
Tank t2 = new Tank(1,0, player);
t2.setLife(30);
player.addUnit(t2);
player.addUnit(new Tank(2,0, player));
player.addUnit(new Bomber(3, 0, player));
player.addUnit(new Bomber(6, 0, player));
player.addUnit(new Bomber(7, 0, player));
player.addUnit(new APU(4, 0, player));
player.addUnit(new APU(5, 0, player));
player.addUnit(new CommandCenter(10, 10, player));

View file

@ -84,13 +84,13 @@ public abstract class Building extends GameEntity{
/**
* Removes this unit from the game.
* Removes this building from the game.
*
*/
public void removeUnit(){
public void removeBuilding(){
unitNode.remove(getSprite());
getPlayer().removeUnit(this);
InGameState.getMap().removePos(oldPos.getX(), oldPos.getY());
InGameState.getMap().removeBuildPos(oldPos.getX(), oldPos.getY(), this.size);
}
/**
@ -99,7 +99,7 @@ public abstract class Building extends GameEntity{
public void update() {
if(getLife()<=0) {
removeUnit();
removeBuilding();
}
}

View file

@ -19,6 +19,8 @@ public abstract class MapEntity extends Unit{
removeUnit();
}
}
public void move(int x, int y){
}
protected void move(int x, int y, boolean b) {}

View file

@ -14,7 +14,7 @@ public class APU extends Unit{
private Sprite sprite;
private Sound gunSound;
private Sound moveSound;
private Sound moveSound[] = new Sound[2];
private Sound attackSound;
private Sound selectSound;
@ -28,12 +28,12 @@ public class APU extends Unit{
sprite.setSize(new Vector2f(40,40));
getNode().add(sprite);
gunSound = new Sound("gunSound", "data/sounds/machinegun.wav");
moveSound = new Sound("moveSound", "data/sounds/APUmove1.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");
selectionBox = new SelectBox(40,40,getMaxLife());
setLife(50);
}
protected SelectBox getSelection() {
@ -56,7 +56,7 @@ public class APU extends Unit{
return gunSound;
}
public Sound getMoveSound() {
return moveSound;
return moveSound[(int)(Math.random()*2)];
}
public Sound getSelectSound() {
return selectSound;

View file

@ -34,7 +34,6 @@ public class Bomber extends Unit{
attackSound = new Sound("attackSound", "data/sounds/BOMBERattack.wav");
selectionBox = new SelectBox(40,40,getMaxLife());
setLife(180);
}
protected SelectBox getSelection() {
@ -70,7 +69,7 @@ public class Bomber extends Unit{
* @return
*/
public float getVelocity() {
return 3;
return 2;
}
/**
* Manages the sprite connected to this unit.

View file

@ -35,7 +35,6 @@ public class Tank extends Unit{
attackSound = new Sound("attackSound", "data/sounds/TANKattack.wav");
selectionBox = new SelectBox(40,40,getMaxLife());
setLife(50);
}
protected SelectBox getSelection() {

View file

@ -157,7 +157,7 @@ public abstract class Unit extends GameEntity{
* Updating the unit
*/
public void update() {
weponTimer++;
if(getLife()<=0) {
removeUnit();
}
@ -271,9 +271,7 @@ public abstract class Unit extends GameEntity{
WeaponHandler.getInstance().addWeapon(wepon);
weponTimer = 0;
}
else{
weponTimer++;
}
}
else{
move(enamyPos.getX(),enamyPos.getY(), false);

View file

@ -15,7 +15,7 @@ public class BomberWeapon extends Weapon{
super(startPos);
setVelocity(4);
setRange(100);
setDamage(30);
setDamage(40);
setReload(150);
hit = false;
position = Map.getPosByPixel(startPos.getX(), startPos.getY());