### how to determine if an actor is completely inside a tile

#### triqui

• Posts: 16
I need to determine if an actor is completely inside a tile but the "this actor hit a tile" does not work because probably checks for collisions on bound box, which do not happen if the actor is completely inside a tile.

Any hint? Some kind of hittestpoint?

#### Alexin

• Posts: 3127
Given the size of an actor, tile and their respective locations, you can easily determine if an actor is contained in a tile or not.
"Find the fun"
alexin@stencyl.com

#### triqui

• Posts: 16
is there a built in way to know tile(s) location? Do I have to code it by myself?

#### coleislazy

• Posts: 2607
You cannot get a specific tile's location, but you can get the tile at a specific location, if that makes sense.

If you have an actor at 133, 98, you can get the tile at its location by dividing the x and y by the tile width and height, respectively, then rounding down. So, if your tiles are 32x32, the top-left corner of your actor would be over the tile at column 4, row 3.

#### triqui

• Posts: 16
do you mean there is something like isThereATileAt(x,y)?

given a coordinate, I can know if there's a tile in it?

#### coleislazy

• Posts: 2607
Ah, sorry, I forgot that part. Check out this article on the tile API: http://www.stencyl.com/help/viewArticle/47. It requires code, though.

Basically, it would be this:
Code: [Select]
`getTileAt(row,colum,layer);`
Note that row is first, not column, as might be expected.

• Posts: 16
great thank you!