Fixed selection bug and changed the astar a bit but its still not right
This commit is contained in:
parent
bdb12e2000
commit
397fb7ebd0
4 changed files with 15 additions and 10 deletions
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue