Slap Gauge

This commit is contained in:
MarcEricMartel
2022-10-11 12:48:08 -04:00
parent 2c41cf90fc
commit 4d11fe8fc7
5 changed files with 170 additions and 1 deletions

View File

@@ -7,6 +7,8 @@ export var air_acceleration = 1
export var normal_acceleration = 6
export var gravity = 100
export var jump = 30
var slap = 0.0
var isSlap = false
export var mouse_sensitivity = 0.03
@@ -65,7 +67,24 @@ func _physics_process(delta):
elif Input.is_action_pressed("move_right"):
direction += transform.basis.x
if Input.is_action_just_released("slap"):
isSlap = false;
elif Input.is_action_just_pressed("slap"):
isSlap = true;
if (isSlap):
slap += delta;
else:
slap -= delta * 4.0;
slap = clamp(slap, 0.0, 1.1)
if (slap > 1.0 && isSlap):
isSlap = false
slap = 0.0;
get_node("/root/Spatial/HUD/ActualHUD/SlapGauge").fill = slap;
direction = direction.normalized()
h_velocity = h_velocity.linear_interpolate(direction * speed, h_acceleration * delta)
movement.z = h_velocity.z + gravity_vec.z