Hello Guest

Author Topic: I must be misunderstanding GetTile() returning the same int for different x,y  (Read 4688 times)

Porthos

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 13
    • View Profile
This should be a fairly easy question. I'm surprised that I have not found a similar question on the forum after searching thoroughly.

I thought GetTile returned a tile Id based on graph coordinates, but inputting different coordinates returns the same int in many cases, so what is it actually for?

For example. on my 128x128 tile map called tileMap, tileMap.GetTile(2,2,0) returns 7 as does 2,14,0 and 6,14,0.      8,14,0 returns 10.
« Last Edit: October 18, 2014, 07:24:29 pm by Porthos »

Porthos

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 13
    • View Profile
After further research I have found that GetTileIdAtPosition is also reporting the same tileId for wildly different tiles. What could be going on?

Porthos

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 13
    • View Profile
Ok. I think I have seen where my thinking went wrong. The tile ID is not a unique identifier for that specific tile at that position tile but rather refers to the pallet tile. So any tile painted from the same pallet tile will have the same Id.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
The tile id corresponds to the sprite id, which is a unique index identifying the sprite, so yup any tile painted from the same tile will have the same id.