I see. First, the error is because you can't use a single number (float) with set_pos()
. Instead, you must pass it a Vector2
, representing both x and y coordinates. For example:
set_pos(Vector2(100, 150))
Second, if you're using KinematicBody2D
you should not be using set_pos()
at all, you should be using move()
. For example, to move the body one pixel to the right:
move(Vector2(1, 0))
See the documentation for KinematicBody2D
here: http://docs.godotengine.org/en/2.1/classes/class_kinematicbody2d.html
The official demo also has a good example of using kinematic bodies, and there are some other tutorials I can link you if you need.