Fixed ClassCastException thrown on Junction use and turret prediction
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user