This commit is contained in:
Anuken
2020-10-27 13:13:54 -04:00
parent 6eab4ebd1c
commit 5582a8bf1b
6 changed files with 21 additions and 26 deletions

View File

@@ -53,13 +53,13 @@ public class Predict{
public static Vec2 intercept(Position src, Position dst, float v){
float ddx = 0, ddy = 0;
if(dst instanceof Hitboxc){
ddx += ((Hitboxc)dst).deltaX();
ddy += ((Hitboxc)dst).deltaY();
if(dst instanceof Hitboxc h){
ddx += h.deltaX();
ddy += h.deltaY();
}
if(src instanceof Hitboxc){
ddx -= ((Hitboxc)src).deltaX()/(Time.delta);
ddy -= ((Hitboxc)src).deltaY()/(Time.delta);
if(src instanceof Hitboxc h){
ddx -= h.deltaX()/(Time.delta);
ddy -= h.deltaY()/(Time.delta);
}
return intercept(src.getX(), src.getY(), dst.getX(), dst.getY(), ddx, ddy, v);
}