+1 vote

I looked into a scene file, and it looks like it's stored in a PoolIntArray. But I can't seem to figure out what these numbers mean.

in Engine by (15 points)

1 Answer

+2 votes

There are three numbers added to the PoolIntArray for each tile you add:

  1. the id of the cell the tile occupies
  2. the id of the tile in the lists of all tiles inside your tileset
  3. the id of the sub-tile if it's an atlas-tile, else it's set to zero
by (10,628 points)

What about the flip flags? Those must be in there too? flipx, flipy, and transpose?

set_cell ( int x, int y, int tile, bool flip_x=false, bool flip_y=false, bool transpose=false, Vector2 autotile_coord=Vector2( 0, 0 ) )

Yes. They are encoded by offsetting the id of the tile (the second value):

flip_x: add 2^29 = 536870912
flip_y: add 2^30 = 1073741824
flip_x AND flip_y: add 2^29 + 2^30 = 1610612737
rotate_left: add 2^30 = 1073741824 and invert the sign
rotate_right: add 2^29 + 2^30 = 1610612737 and invert the sign
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.