Fixed low-FPS movement getting broken

This commit is contained in:
Anuken
2018-11-16 17:28:42 -05:00
parent a7c8526f3e
commit 7f391dacbd
5 changed files with 8 additions and 9 deletions
@@ -293,7 +293,7 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
float x = snappedX(), y = snappedY();
if(!movement.isZero() && moved && !state.isPaused()){
walktime += Timers.delta() * movement.len() / 0.7f * getFloorOn().speedMultiplier;
walktime += movement.len() / 0.7f * getFloorOn().speedMultiplier;
baseRotation = Mathf.slerpDelta(baseRotation, movement.angle(), 0.13f);
}
@@ -608,11 +608,11 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
pointerY = vec.y;
updateShooting();
movement.limit(speed * Timers.delta());
movement.limit(speed).scl(Timers.delta());
if(getCarrier() == null){
if(!ui.chatfrag.chatOpen()){
velocity.add(movement);
velocity.add(movement.x, movement.y);
}
float prex = x, prey = y;
updateVelocityStatus();
@@ -233,7 +233,7 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
status.update(this);
velocity.limit(getMaxVelocity()).scl(status.getSpeedMultiplier());
velocity.limit(getMaxVelocity()).scl(1f + (status.getSpeedMultiplier()-1f) * Timers.delta());
if(isFlying()){
x += velocity.x * Timers.delta();
@@ -238,7 +238,7 @@ public abstract class GroundUnit extends BaseUnit{
}
protected void patrol(){
vec.trns(baseRotation, type.speed);
vec.trns(baseRotation, type.speed * Timers.delta());
velocity.add(vec.x, vec.y);
vec.trns(baseRotation, type.hitsizeTile);
Tile tile = world.tileWorld(x + vec.x, y + vec.y);