Added additional info to block descriptions

This commit is contained in:
Anuken
2017-08-14 15:32:20 -04:00
parent 04e4377ee4
commit 3fa3456c2b
6 changed files with 35 additions and 8 deletions

View File

@@ -72,6 +72,26 @@ public class Enemy extends DestructibleEntity{
out.damage = bullet.damage*Vars.multiplier;
}
public void findClosestNode(){
Pathfind.find(this);
int index = 0;
int cindex = -1;
float dst = Float.MAX_VALUE;
for(Tile tile : path){
if(Vector2.dst(tile.worldx(), tile.worldy(), x, y) < dst){
dst = Vector2.dst(tile.worldx(), tile.worldy(), x, y);
cindex = index;
}
index ++;
}
node = cindex;
}
@Override
public boolean collides(SolidEntity other){
return (other instanceof Bullet) && !(((Bullet)other).owner instanceof Enemy);