How to test when player is over a certain type of tile?

I’d like to ask for something else, if I may: it’s not always practical to create a sprite for every type of a tile; for instance, in a game that has a lot of water and a lot of land, detecting whether you’re flying over land would be very silly to create a sprite for every land tile.

So I’d like to return to the original question, and ask ‘how can I detect what type of tile is at position X,Y [or underneath an existing sprite’s position, or whatever)?’

It would be perfectly acceptable, for my purposes, to be able to enquire of the tile map what tile is at a given position - we have a block to acquire the tile at the co-ordinates, we just can’t tell anything about it at all. Even if we had access to the colour index and could compare it to something else, that would be absolutely fine.

…and I’ve just found I can hack this by reading myTile.tileSet, which is an integer, and using that as a colour index. In case anyone else needs it.

2 Likes