Tilemap.get_bounds() x,y


Posting this to explain to anyone who may search… it’s possible to begin your tilemap anywhere on the grid. Generally you’ll want to start it right at 1,1 for sanity’s sake, but in case you don’t then that’s what the x,y return values are for. But most of the time you don’t want to do that because it adds needless confusion!

local x, y, w, h = tilemap.get_bounds("/level#tilemap") -- if you begin at 1,1 then x,y will be 1,1


This comment solved a problem for me, thanks!

I’m adding a shadow to platforms in my game, and because you can’t get the size of individual layers in a tilemap, the platforms became offset because of the shadow. Now I’m using only the left hand side of the platforms (where there is no shadow) and multiplying that by 2 to get the width minus the shadow. Nice!