Determine how to display a tile based on surrounding tiles
Posted
by
Jsmith
on Game Development
See other posts from Game Development
or by Jsmith
Published on 2012-10-21T19:32:30Z
Indexed on
2012/10/21
23:20 UTC
Read the original article
Hit count: 228
I have a game engine which generates maps randomly, set on a 2d grid which is composed of 34px square graphical tiles.
These tiles can be displayed in any of three ways, wall, corner, and floor(exists in 2 states, passable and impassible), and four directions, north, south, west and east.
What I need to do is, based on the tiles around each individual tile, determine which state to display the tile in, e.g. north wall, northeast corner, floor so that when a player alters the map, the tiles around the affected tile adjust themselves to suit(i.e. tunneling).
In case it becomes important, all gameobjects are inherited from the same class, whether they be players, NPC's, walls, or items.
© Game Development or respective owner