Better bullet range calc
This commit is contained in:
@@ -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. */
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user