This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

i am following the "using tilemaps" tutorial on the documentation page with the tiles given in the tutorial.
this one

i did like the tutorial said but i get 25x25px offset on a 50x50 grid.
since the rootnode's origin is at 0,0 with its center, everything has an offset of 25x25.
i checked the snap-in settings, the root node, the sprites, the staticbody etc. and none of them has a offset. they are all positioned at 0,0 and the "centered" option at the sprites is checked.

i cant make a collisionpolygon2d because they snap-in with an offset of 25x25 px.
i tried to give the rootnode an offset of 25x25 px to counter this problem but as soon as i convert it to a tilemap, the tiles get an offset again.

wtf am i doing wrong?
i am trying to solve this problem for 2 days now.

here is a link to a screenshot, so you can better understand my problem.

https://picload.org/view/rwiworgw/wtf_offset.jpg.html

image

in Engine by (143 points)

1 Answer

0 votes

I think you are complicating yourself. It does not matter that offset, the minute you put the tilemap, they will snap in the grid as you would expect, on a grid based on the origin and not an offset. If you have trouble with the pixel snap just configure it to snap at 1 px per 1px (and not 10x10 as default). If you set 1x1 you will have all the freedom that you need to snap the polygon shape.

by (699 points)

thank you for your reply.

i already configured the gridsnap and i can set sprites with staticbody and a collisionpolygon where i want them to be. unfortunately, this didnt solve my problem.

the problem is the following: i convert the scene with the sprites (with their staticbodies and collisonpolygon children) to a tilemap, i make a new scene with a rootnode, set up a tilemap as child and make it get the .tres resource i converted to earlier. so far so good.

when i now want to "draw" with the tileset, i can highlight a square on my canvas but the tile i picked shows up with an offset of 25x25 relative to the mouse. if i click on a square on the grid, the tile gets placed at the offset, instead of where i highlighted. this happens on my pc with win10, steam-version of godot.

i now tried the whole process again on my laptop (ubuntu 16.04) and didnt had any troubles making a tileset and drawing a tilemap with the converted resource. this might be a bug. i'll try re-installing the steam version of godot on my pc and if this doesnt help, i'll try downloading it from the official website and try again.

Edit:
here is a pic that describes my problem better than i can with my lacking english skills.

https://picload.org/view/rwpargri/srsly_wtf_godot.jpg.html

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.