More bugfixes

This commit is contained in:
Anuken
2020-07-30 20:07:49 -04:00
parent 5ad2807958
commit 40edbe785c
3 changed files with 5 additions and 12 deletions

View File

@@ -11,7 +11,7 @@ import mindustry.gen.*;
abstract class HitboxComp implements Posc, QuadTreeObject{
@Import float x, y;
transient float lastX, lastY, hitSize;
transient float lastX, lastY, deltaX, deltaY, hitSize;
@Override
public void update(){
@@ -33,6 +33,8 @@ abstract class HitboxComp implements Posc, QuadTreeObject{
}
void updateLastPosition(){
deltaX = x - lastX;
deltaY = y - lastY;
lastX = x;
lastY = y;
}
@@ -41,20 +43,12 @@ abstract class HitboxComp implements Posc, QuadTreeObject{
}
float deltaX(){
return x - lastX;
}
float deltaY(){
return y - lastY;
}
float deltaLen(){
return Mathf.len(deltaX(), deltaY());
return Mathf.len(deltaX, deltaY);
}
float deltaAngle(){
return Mathf.angle(deltaX(), deltaY());
return Mathf.angle(deltaX, deltaY);
}
boolean collides(Hitboxc other){