Implement left and right script to character
Character can be fully controllable nowmain
parent
8cab6887b6
commit
203c51c61a
|
@ -12,9 +12,15 @@ func _physics_process(delta):
|
||||||
if Input.is_action_pressed("ui_right"):
|
if Input.is_action_pressed("ui_right"):
|
||||||
$Sprite.flip_h = false
|
$Sprite.flip_h = false
|
||||||
motion.x = SPEED
|
motion.x = SPEED
|
||||||
|
elif Input.is_action_pressed("right"):
|
||||||
|
$Sprite.flip_h = false
|
||||||
|
motion.x = SPEED
|
||||||
elif Input.is_action_pressed("ui_left"):
|
elif Input.is_action_pressed("ui_left"):
|
||||||
$Sprite.flip_h = true
|
$Sprite.flip_h = true
|
||||||
motion.x = -SPEED
|
motion.x = -SPEED
|
||||||
|
elif Input.is_action_pressed("left"):
|
||||||
|
$Sprite.flip_h = true
|
||||||
|
motion.x = -SPEED
|
||||||
else:
|
else:
|
||||||
motion.x = 0
|
motion.x = 0
|
||||||
if is_on_floor():
|
if is_on_floor():
|
||||||
|
|
Loading…
Reference in New Issue