mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-04-01 00:35:29 +02: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();
|
MatrixStack matrices = context.getMatrices();
|
||||||
matrices.push();
|
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 hudX = ((scaledWidth - 50) / 2) + (104 * xDirection);
|
||||||
int hudY = scaledHeight - 50;
|
int hudY = scaledHeight - 50;
|
||||||
|
|
|
@ -57,6 +57,7 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
private int ticksDiving;
|
private int ticksDiving;
|
||||||
|
|
||||||
private float thrustScale = 0;
|
private float thrustScale = 0;
|
||||||
|
private float prevThrustScale;
|
||||||
|
|
||||||
private boolean flapping;
|
private boolean flapping;
|
||||||
private boolean isCancelled;
|
private boolean isCancelled;
|
||||||
|
@ -97,6 +98,11 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
return super.getGravityModifier();
|
return super.getGravityModifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getFlapCooldown(float tickDelta) {
|
||||||
|
float lerpedThrust = MathHelper.lerp(tickDelta, prevThrustScale, thrustScale);
|
||||||
|
return lerpedThrust <= 0.000001F ? 0 : lerpedThrust;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getGravityModifier() {
|
public float getGravityModifier() {
|
||||||
float modifier = getPersistantGravityModifier();
|
float modifier = getPersistantGravityModifier();
|
||||||
|
@ -209,6 +215,8 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
|
prevThrustScale = thrustScale;
|
||||||
|
|
||||||
if (wallHitCooldown > 0) {
|
if (wallHitCooldown > 0) {
|
||||||
wallHitCooldown--;
|
wallHitCooldown--;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue