This commit is contained in:
Jesper Lundin 2007-04-19 12:38:30 +00:00
parent 9d2be3e4cd
commit a2d6b68992
3 changed files with 93 additions and 0 deletions

View file

@ -0,0 +1 @@
2007/4/17

View file

@ -0,0 +1,66 @@
package ei.game.scene.units;
import ei.engine.math.Vector2f;
import ei.engine.math.Vector2i;
import ei.engine.scene.Sprite;
import ei.game.player.Player;
import ei.game.scene.SelectBox;
import ei.game.scene.weapons.MachineGun;
import ei.game.scene.weapons.Weapon;
public class APU extends Unit{
private SelectBox selectionBox;
private Sprite sprite;
public APU(Player p) {
this(0, 0, p);
}
public APU(int x, int y, Player p){
super(100, new Vector2i(x,y), p);
this.sprite = new Sprite("Tank", "data/units/apu/apu0000.png");
sprite.setSize(new Vector2f(40,40));
getNode().add(sprite);
selectionBox = new SelectBox(40,40,getMaxLife());
setLife(50);
}
protected SelectBox getSelection() {
return selectionBox;
}
/**
* Returns the weapon connected to this type
* of unit.
*/
public Weapon getWeapon(Vector2f startPos) {
return new MachineGun(startPos);
}
/**
* This unit type is now destroyed.
*/
public void destroyed(){
}
/**
* returns the velocity of the unit type.
* @return
*/
public float getVelocity() {
return 2;
}
/**
* Manages the sprite connected to this unit.
* @param s
*/
public void setSprite(Sprite s) {
this.sprite = s;
}
/**
* returns the sprite connected to this type
* of unit.
* @return
*/
public Sprite getSprite() {
return this.sprite;
}
}

View file

@ -0,0 +1,26 @@
package ei.game.scene.weapons;
import ei.engine.effects.Particles;
import ei.engine.math.Vector2f;
public class MachineGun extends Weapon{
public MachineGun(Vector2f startPos) {
super(startPos);
setVelocity(4);
setRange(500);
setDamage(2);
setReload(10);
}
public Particles getWeapon() {
Particles part = new Particles("cannon");
part = new Particles("weapon");
part.MaxSpeedX=500;
part.MaxSpeedY=400;
part.MaxSpeedZ=600;
part.rainbow = false;
part.size=1;
return part;
}
}