Coding_Guy
Coding_Guy

Reputation: 151

how do I align tilemap with grid in godot

I have a tilemap in which each tile is 16x16. And it aligns with the Y axis, but not with the X axis. How do I fix this?

you can see the square passing aligning with the Y axis(yellow line), but not with the X axis (purple line)

Upvotes: 1

Views: 599

Answers (1)

Theraot
Theraot

Reputation: 40315

By default your TileMap (assuming you have not moved it) will be placed at the origin.

If there is no Camera2D, the origin will be the top-left corner of the screen. If you add a Camera2D, it will be placed at the origin... So the origin will be at center of the screen. That can be gotcha.

However what we are looking at the bottom of the screen.


Thus, the issue is that the tile size is not a divisor of the screen size.

As you probably know, you can set the size of the tiles in the TileMap in the inspector.

If you want to change the screen size, you can find it in Project Settings: display/window/size/viewport_width and display/window/size/viewport_height.

*You also want to be aware of display/window/stretch/mode and display/window/stretch/aspect. See Multiple resolutions.

Upvotes: 1

Related Questions