Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Digitijs | |
Old Version | Published before Godot 3 was released. |
I’m absolute beginner not only to Godot but also to game making in general.
I got in a little problem: when I’m moving diagonally against the wall, the movement is slowing down A LOT. How can I make it smooth so that it would be just as fast as if normally walking?
func _fixed_process(delta):
var motion = Vector2(0, 0)
#motion
if (Input.is_action_pressed("ui_up")):
motion.y = -1
RayNode.set_rotd(180)
if (Input.is_action_pressed("ui_down")):
motion.y = 1
RayNode.set_rotd(0)
if (Input.is_action_pressed("ui_right")):
motion.x = 1
RayNode.set_rotd(90)
if (Input.is_action_pressed("ui_left")):
motion.x = -1
RayNode.set_rotd(-90)
motion = motion.normalized()*MOTION_SPEED*delta
move(motion)
This is basically how I did movement using tutorials.
p.s. Also while I’m at it. When I have 2 walls 16x16 pixels and a gap between them the same size, I can’t move through the gap if the player has 16x16 collision. I simply solved that with changing his collision to 15x15 so it’s not a big deal, I guess