implement speed mult
This commit is contained in:
parent
12093b4234
commit
014797238c
2 changed files with 3 additions and 1 deletions
|
|
@ -11,6 +11,8 @@ const DEADZONE = 0.1
|
||||||
var h_press_tick: int = 0 ## last time horizontal axis was pressed
|
var h_press_tick: int = 0 ## last time horizontal axis was pressed
|
||||||
var v_press_tick: int = 0 ## last time vertical axis was pressed
|
var v_press_tick: int = 0 ## last time vertical axis was pressed
|
||||||
|
|
||||||
|
var speed_mult: float = 1.0
|
||||||
|
|
||||||
|
|
||||||
func _input(event: InputEvent) -> void:
|
func _input(event: InputEvent) -> void:
|
||||||
if event.is_action_pressed("move_left") or event.is_action_pressed("move_right"):
|
if event.is_action_pressed("move_left") or event.is_action_pressed("move_right"):
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ func _state_physics_update(_delta: float) -> void:
|
||||||
#region player physics
|
#region player physics
|
||||||
var direction: Vector2 = player.get_movement_vector()
|
var direction: Vector2 = player.get_movement_vector()
|
||||||
direction = direction.normalized()
|
direction = direction.normalized()
|
||||||
player.velocity = direction * player.max_speed
|
player.velocity = direction * player.max_speed * player.speed_mult
|
||||||
|
|
||||||
player.move_and_slide()
|
player.move_and_slide()
|
||||||
#endregion
|
#endregion
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue