Fixed selection bug and changed the astar a bit but its still not right

This commit is contained in:
Ziver Koc 2007-04-19 15:41:31 +00:00
parent bdb12e2000
commit 397fb7ebd0
4 changed files with 15 additions and 10 deletions

View file

@ -3,7 +3,6 @@ package ei.game.scene.units;
import java.util.LinkedList;
import ei.engine.effects.Particles;
import ei.engine.math.Vector2f;
import ei.engine.math.Vector2i;
import ei.engine.math.Vector3f;
@ -209,13 +208,14 @@ public abstract class Unit extends GameEntity{
unitNode.getLocation().add(0f, -getVelocity(), 0f);
}
if(attack != null && getWeapon(new Vector2f(unitNode.getLocation().getX(), unitNode.getLocation().getY()))
.onRange(new Vector2f(attack.getNode().getLocation().getX(), attack.getNode().getLocation().getY()))){
moveTo = null;
}
else if(Math.abs(moveTo.getX() - unitNode.getLocation().getX()) < getVelocity()+1
&& Math.abs(moveTo.getY() - unitNode.getLocation().getY())< getVelocity()+1 ){
if(path != null && !path.isEmpty()){
if(attack != null && getWeapon(new Vector2f(unitNode.getLocation().getX(), unitNode.getLocation().getY()))
.onRange(new Vector2f(attack.getNode().getLocation().getX(), attack.getNode().getLocation().getY()))){
moveTo = null;
}
else if(path != null && !path.isEmpty()){
AStarNode temp = path.poll();
if(InGameState.getMap().isPosEmpty(temp.getX(), temp.getY())){
oldVect = new Vector2i((int)moveTo.getX(), (int)moveTo.getY());