0 votes

A tileMap created on a child node,it's origin start by top-left corner of the child node when drawing tiles in engine. But when it starts running, its origin changes to be calculated from the top left corner of the main scene when used "get_cellv()"

(Use mouse detection methods :
getcellv(worldtomap(getglobalmouseposition) ).

How do I get the tilemap origin to start at the top left corner of the child node?
ps: the child node is Control node,It is used in automatic alignment of VBoxContainer

in Engine by (56 points)
edited by

1 Answer

0 votes
Best answer

So is the tilemap a parent or a child of the Control node? Either way you should have no problem. You just need to use the proper method. If you are taking a position from the Control node use rect_global_position() and turn it into a map position using tilemap.world_to_map(rect_global_position()).

by (396 points)
edited by
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 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 webmaster@godotengine.org with your username.