mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Added a indicator to show when the cooldown between flaps is complete
This commit is contained in:
parent
72f6c4ff19
commit
3fcb05de81
2 changed files with 18 additions and 0 deletions
|
@ -88,6 +88,16 @@ public class UHud {
|
|||
|
||||
MatrixStack matrices = context.getMatrices();
|
||||
matrices.push();
|
||||
matrices.translate(scaledWidth / 2, scaledHeight / 2, 0);
|
||||
|
||||
float flapCooldown = pony.getPhysics().getFlapCooldown(tickDelta);
|
||||
if (flapCooldown > 0) {
|
||||
float angle = MathHelper.TAU * flapCooldown;
|
||||
DrawableUtil.drawArc(context.getMatrices(), 3, 6, -angle / 2F, angle, 0x888888AF, false);
|
||||
}
|
||||
|
||||
matrices.pop();
|
||||
matrices.push();
|
||||
|
||||
int hudX = ((scaledWidth - 50) / 2) + (104 * xDirection);
|
||||
int hudY = scaledHeight - 50;
|
||||
|
|
|
@ -57,6 +57,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
private int ticksDiving;
|
||||
|
||||
private float thrustScale = 0;
|
||||
private float prevThrustScale;
|
||||
|
||||
private boolean flapping;
|
||||
private boolean isCancelled;
|
||||
|
@ -97,6 +98,11 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
return super.getGravityModifier();
|
||||
}
|
||||
|
||||
public float getFlapCooldown(float tickDelta) {
|
||||
float lerpedThrust = MathHelper.lerp(tickDelta, prevThrustScale, thrustScale);
|
||||
return lerpedThrust <= 0.000001F ? 0 : lerpedThrust;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getGravityModifier() {
|
||||
float modifier = getPersistantGravityModifier();
|
||||
|
@ -209,6 +215,8 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
prevThrustScale = thrustScale;
|
||||
|
||||
if (wallHitCooldown > 0) {
|
||||
wallHitCooldown--;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue