fixed diagonal

This commit is contained in:
SarDinah 2022-04-05 21:05:59 -07:00
parent 5f0208ab7a
commit d5ce5f9d65

View file

@ -25,6 +25,8 @@ func _physics_process(delta):
direction.y -= 1 direction.y -= 1
if Input.is_action_pressed("down"): if Input.is_action_pressed("down"):
direction.y += 1 direction.y += 1
if direction.y != 0 and direction.x !=0:
direction = Vector2.ZERO
print(direction.normalized()*speed) print(direction.normalized()*speed)
direction = direction.normalized() * speed direction = direction.normalized() * speed
move_and_collide(direction) move_and_collide(direction)