Better bullet range calc

This commit is contained in:
Anuken
2021-09-18 14:32:57 -04:00
parent 01771c5288
commit 3f996cf294
3 changed files with 2 additions and 7 deletions

View File

@@ -199,7 +199,7 @@ public class BulletType extends Content implements Cloneable{
/** Returns maximum distance the bullet this bullet type has can travel. */
public float range(){
return Math.max(speed * lifetime * (1f - drag), maxRange);
return Mathf.zero(drag) ? speed * lifetime : Math.max(speed * (1f - Mathf.pow(1f - drag, lifetime)) / drag, maxRange);
}
/** @return continuous damage in damage/sec, or -1 if not continuous. */

View File

@@ -43,11 +43,6 @@ public class LiquidBulletType extends BulletType{
this(null);
}
@Override
public float range(){
return speed * lifetime / 2f;
}
@Override
public void update(Bullet b){
super.update(b);