slow down player when using mortar
This commit is contained in:
parent
9e47e27cbf
commit
3c0427969c
1 changed files with 9 additions and 1 deletions
|
|
@ -34,6 +34,8 @@ var state := State.NORMAL
|
||||||
var dash_direction: Vector2
|
var dash_direction: Vector2
|
||||||
var stamina := 1.0
|
var stamina := 1.0
|
||||||
|
|
||||||
|
var speed_mul := 1.
|
||||||
|
|
||||||
@export var guns: Array[Gun]
|
@export var guns: Array[Gun]
|
||||||
var gun_index := 0:
|
var gun_index := 0:
|
||||||
set(v):
|
set(v):
|
||||||
|
|
@ -59,7 +61,7 @@ func _process_movement(delta: float) -> void:
|
||||||
var input = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
var input = Input.get_vector("move_left", "move_right", "move_up", "move_down")
|
||||||
input.normalized()
|
input.normalized()
|
||||||
var mul := 10. if DebugMenu.high_speed_hack else 1.
|
var mul := 10. if DebugMenu.high_speed_hack else 1.
|
||||||
var desired_velocity = Vector3(input.x, 0., input.y) * MOVE_SPEED * mul
|
var desired_velocity = Vector3(input.x, 0., input.y) * MOVE_SPEED * mul * speed_mul
|
||||||
velocity = exp_lerp(velocity, desired_velocity, 20, delta)
|
velocity = exp_lerp(velocity, desired_velocity, 20, delta)
|
||||||
move_and_slide()
|
move_and_slide()
|
||||||
|
|
||||||
|
|
@ -102,6 +104,12 @@ func _process_shoot(delta: float) -> void:
|
||||||
# State.DASHING: clock_mul = 2.5
|
# State.DASHING: clock_mul = 2.5
|
||||||
# State.LOCKED: clock_mul = 2.5
|
# State.LOCKED: clock_mul = 2.5
|
||||||
|
|
||||||
|
if gun_index == MORTAR_IDX and Input.is_action_pressed("fire"):
|
||||||
|
speed_mul = exp_lerp(speed_mul, 0.25, 5, delta)
|
||||||
|
else:
|
||||||
|
speed_mul = exp_lerp(speed_mul, 1., 5, delta)
|
||||||
|
|
||||||
|
|
||||||
gun.fire_clock -= delta * clock_mul
|
gun.fire_clock -= delta * clock_mul
|
||||||
if Input.is_action_pressed("fire") and gun.fire_clock <= 0.:
|
if Input.is_action_pressed("fire") and gun.fire_clock <= 0.:
|
||||||
gun.fire(aim_angle)
|
gun.fire(aim_angle)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue