Fixed ClassCastException thrown on Junction use and turret prediction

This commit is contained in:
Anuken
2017-09-11 17:50:42 -04:00
parent d53f12aeb9
commit 4c860a0315
8 changed files with 35 additions and 26 deletions
@@ -12,6 +12,7 @@ import io.anuke.mindustry.world.Tile;
import io.anuke.ucore.core.Draw;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.entities.*;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Timers;
public class Enemy extends DestructibleEntity{
@@ -122,11 +123,11 @@ public class Enemy extends DestructibleEntity{
move();
xvelocity = x - lastx;
yvelocity = y - lasty;
xvelocity = (x - lastx) / Mathf.delta();
yvelocity = (y - lasty) / Mathf.delta();
if(target == null){
direction.add(xvelocity, yvelocity);
direction.add(xvelocity * Mathf.delta(), yvelocity * Mathf.delta());
direction.limit(speed*rotatespeed);
}else{
float angle = angleTo(target);
@@ -0,0 +1,22 @@
package io.anuke.mindustry.entities.enemies;
import io.anuke.ucore.util.Mathf;
import io.anuke.ucore.util.Timers;
public class TestEnemy extends Enemy{
boolean dir = false;
public TestEnemy(int spawn) {
super(spawn);
maxhealth = 99999;
heal();
}
void move(){
if(Timers.get(this, "asd", 300)){
dir = !dir;
}
move(dir ? -0.3f * Mathf.delta() : 0.3f * Mathf.delta(), 0);
}
}