Use move_to( Position )
, not set_pos()
, no need to call test_move()
.
In Godot 3 you want to call move_and_collide()
but it needs vector relative to player's position
var relativeVector = Vector2(0, 0)
put it in _process()
and modify according to user input. You won't need Position variable.
BTW do you have CollisionShape2D nodes in your body nodes?