Determine how to display a tile based on surrounding tiles
- by Jsmith
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.