• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Question - Code tile_map_get_at_pixel()

Hi everyone!
So far, I think I'm liking what I see, and this tile system is awesome!

HOWEVER!

I'm not sure I fully understand how "tile_map_get_at_pixel()" is used.
I've been looking at the platformer demo, and from what I can tell, it seems to return a tile index, based on the position in the tileset e.g. if you numbered all the tiles from left to right, starting with 0, the ladder ID is 2, which corresponds with the code.

My issue is that if this is the case, there is no convenient way to tell what ID a tile has, particularly with large tilesets (perhaps a toggleable, numbered overlay could help?), though I can see the tile ID in the brush editor (if I select it). Sure, I could use fewer tiles, but I like options.

I could be totally misunderstanding this, since it's what I've gathered from code - I found the documentation on the function more confusing than helpful, especially when combined with how it is used in the demo. I had a quick skim through the tutorial videos too, but I didn't see tile collision covered in the GML ones either.

So, precisely how should this function be used? I'd rather not just guess it.
(Also, why does the top-left tile have to be blank? Not really an important question, just curious, since I'm so used to the old system)

Anyway, other than that, I think I'm happy with everything new. Only thing more I could ask for is a native SLERP function and a native function to build a matrix from a quaternion array.
 

Mike

nobody important
GMC Elder
Look at the demos, in particular the "collision" layers (which are hidden by default). Also if you select a tile, it tells you the tile number.
 
Yeah, I checked the demos (where I based my idea).
So basically, it does return the same number as shown by the brush tool? (I did find the ID at the bottom of the room editor with the tile selected, so that's good)
Anyway, thank you. I just wasn't 100% sure and didn't want to base my future code on a potential misunderstanding :p
 

Mike

nobody important
GMC Elder
More or less. if you start rotating and flipping them, the numbers will change a little, as some of the "bits" in the INT are flags. However you'll notice it gets masked with something call tile_index_mask, and this will return you JUST the tile ID.
 
That's handy to know, saves me shaking my fist later!
Again, thanks for answering, and thanks for dealing with so many of our questions!
 
Top