From 8ff57fda63a328011ab7343104a8e9c047480d9a Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Tue, 17 Apr 2007 14:21:36 +0000 Subject: [PATCH] LOL --- src/ei/game/scene/SelectBox.java | 16 ++++++++-------- src/ei/game/scene/units/Tank.java | 5 +++-- src/ei/game/scene/units/Unit.java | 2 +- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/ei/game/scene/SelectBox.java b/src/ei/game/scene/SelectBox.java index 4e4cf05..97a70fe 100644 --- a/src/ei/game/scene/SelectBox.java +++ b/src/ei/game/scene/SelectBox.java @@ -11,8 +11,8 @@ public class SelectBox { private Node selectNode; private Sprite value; private int max; - private float whidth; - private static final float hight = 3; + private float width; + private static final float height = 3; /** * Creates a selection box with health bar @@ -23,7 +23,7 @@ public class SelectBox { */ public SelectBox(float x, float y, int max){ this.max = max; - this.whidth = x; + this.width = x; selectNode = new Node("SelectionNode"); Texture tex = new Texture(); @@ -33,13 +33,13 @@ public class SelectBox { tex2.setColor(new Vector4f(0.3f, 1.0f, 0.3f, 0.6f)); value = new Sprite("Healthvalue",tex2); - value.setSize(new Vector2f(x,hight)); - value.setLocation(new Vector2f(0,-x/2+hight/2)); + value.setSize(new Vector2f(x,height)); + value.setLocation(new Vector2f(0,-x/2+height/2)); selectNode.add(value); Box bar = new Box("bar",tex); - bar.setSize(new Vector2f(x,hight)); - bar.setLocation(new Vector2f(0,-x/2+hight/2)); + bar.setSize(new Vector2f(x,height)); + bar.setLocation(new Vector2f(0,-x/2+height/2)); selectNode.add(bar); Box select = new Box("select",tex); @@ -64,6 +64,6 @@ public class SelectBox { * @param v The value of the health bar */ public void setValue(int v){ - value.setSize(new Vector2f((v/max)*whidth,hight)); + value.setSize(new Vector2f((v/max)*width,height)); } } diff --git a/src/ei/game/scene/units/Tank.java b/src/ei/game/scene/units/Tank.java index 41c85b1..1bf8b74 100644 --- a/src/ei/game/scene/units/Tank.java +++ b/src/ei/game/scene/units/Tank.java @@ -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() { diff --git a/src/ei/game/scene/units/Unit.java b/src/ei/game/scene/units/Unit.java index 8c2d95a..36c558e 100644 --- a/src/ei/game/scene/units/Unit.java +++ b/src/ei/game/scene/units/Unit.java @@ -84,7 +84,7 @@ public abstract class Unit extends GameEntity{ public void move(int x, int y) { path = (LinkedList) 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());