This commit is contained in:
parent
0c1c9aa2dd
commit
902becd06f
1 changed files with 59 additions and 0 deletions
59
src/ei/game/scene/units/Bomber.java
Normal file
59
src/ei/game/scene/units/Bomber.java
Normal file
|
|
@ -0,0 +1,59 @@
|
||||||
|
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.CannonBall;
|
||||||
|
import ei.game.scene.weapons.Weapon;
|
||||||
|
|
||||||
|
public class Bomber extends Unit{
|
||||||
|
private SelectBox selectionBox;
|
||||||
|
private Sprite sprite;
|
||||||
|
public Bomber(Player p) {
|
||||||
|
this(0, 0, p);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Bomber(int x, int y, Player p){
|
||||||
|
super(100, new Vector2i(x,y), p);
|
||||||
|
this.sprite = new Sprite("Tank", "data/units/bomber/bomber0000.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 CannonBall(startPos);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* This unit type is now destroyed.
|
||||||
|
*/
|
||||||
|
public void destroyed(){
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue