0 votes

Hey guys im new to Godot and im in the process of learning GDscript. I was following the document and tried to replicate the "Click and move" tutorial in the document, but for some reason my instance goes somewhere else, i even copied the doc code and tried it but still no dice. I ended up printing the mouse position and the target position, and they match and both are correct, but I think the "moveandslide" is placing the coordinates somewhere else for some reason, is the doc out dated?

Heres a youtube link: https://www.youtube.com/watch?v=TmBRYtpkLEU


in Engine by (21 points)
edited by

wait wait, i looked under the sprite transform, and for some reason its staying at 0,0 and not following the parents position....how do i upload the project lol

The sprite's transform should be 0,0 relative to the parent. And you can upload the project to any file sharing website or github or something like that.

do you think the "target" vector is automatically being pre-set? if i can remember my git, ill be sure to upload it

Yes. The target vector is initialized at (0, 0). If you don't want it to be (0, 0), you should put this in your ready function:

func _ready():
    target = position

I thought so lol thanks!

1 Answer

0 votes

So I just figured it out, I guess the instance needs to start at 0,0 for it to work properly? I had originally placed it in the middle of the screen (along with everything else) because who starts at 0,0 lol but for some reason thats where it needs to start, theres probably some back end offset happening, if I find the code in the source ill change it up

by (21 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.