# Trying to find width of tilemap level

**URL:** https://forum.makecode.com/t/trying-to-find-width-of-tilemap-level/1134
**Category:** Arcade
**Created:** [January 30, 2020, 3:27am UTC](https://forum.makecode.com/t/trying-to-find-width-of-tilemap-level/1134 "2020-01-30T03:27:45Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![p3nguinc4g3](https://avatars.discourse-cdn.com/v4/letter/p/ee59a6/32.png) [@p3nguinc4g3](https://forum.makecode.com/u/p3nguinc4g3)
#### Post date: [January 30, 2020, 3:27am UTC](https://forum.makecode.com/t/trying-to-find-width-of-tilemap-level/1134/1 "2020-01-30T03:27:45Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)
#### Post date: [October 3, 2020, 10:32am UTC](https://forum.makecode.com/t/trying-to-find-width-of-tilemap-level/1134/2 "2020-10-03T10:32:26Z")

</div>

@p3nguinc4g3

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.

[https://forum.makecode.com/c/Share-your-Arcade-projects-here/help/14](https://forum.makecode.com/c/Share-your-Arcade-projects-here/help/14)

---

<div class="post-metadata">

### Author: ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)
#### Post date: [October 3, 2020, 7:25pm UTC](https://forum.makecode.com/t/trying-to-find-width-of-tilemap-level/1134/3 "2020-10-03T19:25:21Z")

</div>

@p3nguinc4g3  
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

> [@Tilemap col/row to x/y conversion](https://forum.makecode.com/t/tilemap-col-row-to-x-y-conversion/3176):
>
> Is there a way to easily convert a tilemap col/row position to an x/y coorindates? Some block refer to tilemap col/row positions and others refer to x/y coordinates. So far the only way I know to get the actual x/y coordinates is to turn on physics for my character, walk them over the tilemap in game, and read the co/row position physics is showing. I need both the col/row and x/y values because I am trying to create an event that willcause the camera to refocus on a part of the map when my c…
