Implement left and right script to character

Character can be fully controllable now
main
tihgs 2025-06-20 16:00:04 +08:00
parent 8cab6887b6
commit 203c51c61a
Signed by: tihgs
GPG Key ID: 4E80959CDE5EDCA0
1 changed files with 6 additions and 0 deletions

View File

@ -12,9 +12,15 @@ func _physics_process(delta):
if Input.is_action_pressed("ui_right"):
$Sprite.flip_h = false
motion.x = SPEED
elif Input.is_action_pressed("right"):
$Sprite.flip_h = false
motion.x = SPEED
elif Input.is_action_pressed("ui_left"):
$Sprite.flip_h = true
motion.x = -SPEED
elif Input.is_action_pressed("left"):
$Sprite.flip_h = true
motion.x = -SPEED
else:
motion.x = 0
if is_on_floor():