Detect Neighboring Tiles?

I'm attempting to make a square tile-based game, but I can't find out how to detect which kind of tiles border other kinds of tiles on the fly. For instance, if I need the game to recognize inside a behavior that a specific grass tile has a hill tile on its right side, water tile on its left side, and grass tiles on the top and bottom of it, is there an economical way to do that? Do the tiles need to be implemented as actors?

Joe

  • *
  • Posts: 2480
You can use Actors. An alternative would be to use the tile API, which currently requires some AS3 code.

I realize this is probably a simple question, but what is the method then with actors? Will collision detection do the job if every actor is perfectly spaced like tiles?

niccosw

  • Posts: 91
One thing you might try is having four invisible sensor actors shadow the player, each offset one grid space in each direction (NSEW). They would report back what type of tile they are standing on and the player actor could use that data.

Alexin

  • *
  • Posts: 3132
I discourage the use of actors in this case. It can quickly become a bottleneck. If you don't know AS3, then you could someone to make an interface for this specific problem using a Design Mode behavior.
"Find the fun"
alexin@stencyl.com