Slap Gauge
This commit is contained in:
19
Player.gd
19
Player.gd
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user