From 7115379ccf5714816eeb91fc16d3a63e019c8082 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Sun, 14 Feb 2021 14:53:17 +0100 Subject: Adds user configurable key bindings --- Characters/Character.gd | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Characters') 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(): -- cgit v1.2.3