This commit is contained in:
Ziver Koc 2007-04-17 14:21:36 +00:00
parent 347a269c4d
commit 8ff57fda63
3 changed files with 12 additions and 11 deletions

View file

@ -12,12 +12,13 @@ public class Tank extends Unit{
}
public Tank(int x, int y){
super(10, new Vector2i(x,y));
super(100, new Vector2i(x,y));
Sprite sp = new Sprite("Tank", "data/units/tank.png");
sp.setSize(new Vector2f(50,37));
getNode().add(sp);
selectionBox = new SelectBox(40,40,getMaxLife());
selectionBox = new SelectBox(40,40,getMaxLife());
setLife(50);
}
protected SelectBox getSelection() {

View file

@ -84,7 +84,7 @@ public abstract class Unit extends GameEntity{
public void move(int x, int y) {
path = (LinkedList<AStarNode>) new AStar().startSearch(oldPos,new Vector2i(x,y));
if(path != null && !path.isEmpty()){
if(path != null && !path.isEmpty() && moveTo == null){
AStarNode temp = path.poll();
moveTo = Map.getPixelByPos(temp.getX(), temp.getY());
setPos(temp.getX(), temp.getY());