Topic was automatically imported from the old Question2Answer platform.
Asked By
ge-orgio
Hi,
I am not an experienced GODOT user. Actually I use the engine for less than a month
The answer for me, is to initialize the position in the _ready function
But it is not working in my project.
Please view this video. You can see the orange platform, to start from the upper left of the screen and not from the first waypoint as it should be
Here is the code in _ready function:
func _ready():
if waypoints == null:
set_physics_process(false)
return
position = waypoints.getStartPos()
targetPos = waypoints.getNextPos()
timer.wait_time = 1.0
The project is very small and can be downloaded here
In Godot position property means local position, while global_position defines position in objective coordinates.
I suspect this is the problem here, even not knowing your getters.
Try replacing position with global_position in both scripts everywhere
In the Project Manager, go to the Asset Library Projects, and download any 2D Physics Platformer.
The scripts there will give you and idea how it can be done.
Thank you but I prefer to find where I am wrong. I think this is the best way to learn.
I followed the basic rules of GODOT and my script does not work and I am wondering why
Also I noticed that debugger does not work as I expected and does not helping me