diff options
author | Daniel Weipert <code@drogueronin.de> | 2021-02-14 14:53:17 +0100 |
---|---|---|
committer | Daniel Weipert <code@drogueronin.de> | 2021-02-14 14:53:17 +0100 |
commit | 7115379ccf5714816eeb91fc16d3a63e019c8082 (patch) | |
tree | f28c7595ca3f1324bcffadd40027df6c46f7d321 /Characters/Character.gd | |
parent | 332bab8de321d0358b30d5bf159cbda512c14852 (diff) |
Adds user configurable key bindings
Diffstat (limited to 'Characters/Character.gd')
-rw-r--r-- | Characters/Character.gd | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Characters/Character.gd b/Characters/Character.gd index a60046b..175094d 100644 --- a/Characters/Character.gd +++ b/Characters/Character.gd @@ -14,7 +14,7 @@ var jumpHeightModifier = 0 func _physics_process(_delta): - if Input.is_action_pressed("ui_left"): + if Input.is_action_pressed("DIRECTION_LEFT"): velocity.x = -SPEED direction = Enum.DIRECTION.LEFT $Sprite.flip_h = true @@ -23,7 +23,7 @@ func _physics_process(_delta): $Sprite.play("run") else: $Sprite.play("walk") - elif Input.is_action_pressed("ui_right"): + elif Input.is_action_pressed("DIRECTION_RIGHT"): velocity.x = SPEED direction = Enum.DIRECTION.RIGHT $Sprite.flip_h = false @@ -62,7 +62,7 @@ func _physics_process(_delta): # jump - if Input.is_action_just_pressed("ui_up"): + if Input.is_action_just_pressed("JUMP"): if is_on_floor(): canDoubleJump = true velocity.y = JUMPFORCE @@ -70,11 +70,11 @@ func _physics_process(_delta): elif not is_on_floor() and not is_on_wall() and canDoubleJump: canDoubleJump = false velocity.y = JUMPFORCE - if Input.is_action_pressed("ui_up"): + if Input.is_action_pressed("JUMP"): jumpHeightModifier += 10 if jumpHeightModifier > 0: jumpHeightModifier = 0 - if Input.is_action_just_released("ui_up"): + if Input.is_action_just_released("JUMP"): velocity.y -= jumpHeightModifier @@ -82,14 +82,14 @@ func _physics_process(_delta): velocity.y *= 0.8 $Sprite.play("wall") - if Input.is_action_just_pressed("ui_up"): + if Input.is_action_just_pressed("JUMP"): velocity.y = JUMPFORCE * 0.75 if direction == Enum.DIRECTION.LEFT: - Input.action_release("ui_left") + Input.action_release("DIRECTION_LEFT") velocity.x = 2000 $Sprite.flip_h = false elif direction == Enum.DIRECTION.RIGHT: - Input.action_release("ui_right") + Input.action_release("DIRECTION_RIGHT") velocity.x = -2000 $Sprite.flip_h = true @@ -99,7 +99,7 @@ func _physics_process(_delta): func is_running(): - return Input.is_action_pressed("ui_accept") and is_on_floor() + return Input.is_action_pressed("RUN") and is_on_floor() func check_flag(): |