SLAPPENING
This commit is contained in:
33
Player.gd
33
Player.gd
@@ -8,7 +8,8 @@ export var normal_acceleration = 6
|
||||
export var gravity = 100
|
||||
export var jump = 30
|
||||
var slap = 0.0
|
||||
var isSlap = false
|
||||
var chargeSlap = false
|
||||
var isSlap = false;
|
||||
|
||||
export var mouse_sensitivity = 0.03
|
||||
|
||||
@@ -66,25 +67,23 @@ func _physics_process(delta):
|
||||
direction -= transform.basis.x
|
||||
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"):
|
||||
|
||||
# Slappening
|
||||
if Input.is_action_just_pressed("slap"):
|
||||
chargeSlap = true;
|
||||
elif Input.is_action_just_released("slap"):
|
||||
chargeSlap = false;
|
||||
isSlap = true;
|
||||
|
||||
|
||||
if (isSlap):
|
||||
slap += delta;
|
||||
else:
|
||||
isSlap = false;
|
||||
if (chargeSlap):
|
||||
slap += delta * 1.5;
|
||||
else:
|
||||
slap -= delta * 4.0;
|
||||
|
||||
slap = clamp(slap, 0.0, 1.1)
|
||||
|
||||
if (slap > 1.0 && isSlap):
|
||||
isSlap = false
|
||||
slap = 0.0;
|
||||
|
||||
slap -= delta * 8.0;
|
||||
slap = clamp(slap, 0.0, 1.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