Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Repertix |
So, I’m new using this engine and watched a tutorial to make a simple platformer, but when I use motion.x = MAX_SPEED it doesn’t move, I checked if I introduced something wrong in the code or keymaps and everything seems fine.
var left = Input.is_action_pressed("left")
var right = Input.is_action_pressed("right")
var MAX_SPEED = 20
var motion = Vector2()
if left:
motion.x = -MAX_SPEED
elif right:
motion.x = MAX_SPEED
else:
motion.x = 0
I’ll appreciate any help, thx.
Try putting ui_left
and ui_right
instead of left
and right
. Also, since you didn’t post the entire code, are you using motion
to update the position of the character?
exuin | 2020-09-06 21:44