TOUR
PRICING
HELP
Stencylpedia
Blocks Guide
Sample Games
Developer Center
FORUMS
CHAT
#MADEINSTENCYL
EDUCATION
SIGN IN
×
Welcome back!
Username or E-mail
Password
(
Forgot?
)
C
OMMUNITY
Home
Issue Tracker
Inbox [0]
New Posts
New Replies
Search
Stencyl Community
→
Stencyl
→
Ask a Question
→
how to determine if an actor is completely inside a tile
Pages:
1
how to determine if an actor is completely inside a tile
triqui
Posts: 16
January 11, 2012, 04:03:56 am
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
January 11, 2012, 04:40:31 am
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
January 11, 2012, 05:07:53 am
is there a built in way to know tile(s) location? Do I have to code it by myself?
coleislazy
Posts: 2607
January 11, 2012, 05:11:22 am
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
January 11, 2012, 05:35:03 am
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
January 11, 2012, 05:36:58 am
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.
triqui
Posts: 16
January 11, 2012, 06:50:18 am
great thank you!
Pages:
1