Trying to find width of tilemap level

I’m trying to run a calculation to see if something is outside of the tilemap level. I can’t seem to find an easy way to check to see what the width and height of the level is AND retain the ability to edit the tilemap in blocks. I can move the tilemap data declaration into a variable, which lets me find width and height, but then I’m unable to use the editor for it anymore. Same thing if I just move the base image out of the tilemap data declaration. I can look up screen width but that’s not the same as level width. I was going to just query tiles moving out until I didn’t get anything back as the basis but I wanted to double check if I was missing something obvious first.

1 Like


How dit you set the tileMapData into a variable? I am also curious to find out what the width and height is. There is a function, TileMapData.isOutsideMap(x, y), but I am not sure how to use it. Instead of defining a tile as the random location the sprite starts at, I want to place the sprite at the bottom and middle of the tilemap. Maybe the width and height of a tilemap works differently than the location of a tile.

Maybe if you repost this issue under Arcade | Help, someone else might help.

You have probably moved on from your original question, but I found this post which explains one getting the dimensions of a tilemap, in relation to the x,y of a sprite