LOLOOOOOOL
This commit is contained in:
parent
69adb14553
commit
88d92f1b96
4 changed files with 62 additions and 7 deletions
|
|
@ -1,7 +1,10 @@
|
|||
package ei.game.scene.units;
|
||||
|
||||
import ei.engine.math.Vector2f;
|
||||
import ei.engine.math.Vector2i;
|
||||
import ei.engine.scene.Sprite;
|
||||
import ei.game.gamestate.InGameState;
|
||||
import ei.game.player.Human;
|
||||
import ei.game.scene.GameEntity;
|
||||
import ei.game.scene.weapons.Weapon;
|
||||
|
||||
|
|
@ -9,10 +12,12 @@ public abstract class Unit extends GameEntity{
|
|||
|
||||
private Sprite looks;
|
||||
private Weapon weapon;
|
||||
private Vector2i oldPos;
|
||||
|
||||
public Unit(int l) {
|
||||
super(l);
|
||||
// TODO Auto-generated constructor stub
|
||||
looks = new Sprite("none");
|
||||
InGameState.getHuman().addUnit(this);
|
||||
}
|
||||
|
||||
public Sprite getSprite(){
|
||||
|
|
@ -21,5 +26,18 @@ public abstract class Unit extends GameEntity{
|
|||
public void setSprite(Sprite image) {
|
||||
looks = image;
|
||||
}
|
||||
public void setPos(int x, int y) {
|
||||
oldPos = new Vector2i(x, y);
|
||||
InGameState.getMap().setPos(this, x, y);
|
||||
|
||||
}
|
||||
public void move(int x, int y) {
|
||||
if(oldPos!=null) {
|
||||
InGameState.getMap().removePos(oldPos.getX(), oldPos.getY());
|
||||
}
|
||||
setPos(x, y);
|
||||
looks.move(new Vector2f(x, y));
|
||||
oldPos = new Vector2i(x, y);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue