Corners aren't much harder than the head of tail.
The easiest way to approach that IMHO is to assign a binary value to each side of the tiles.
So "
up"
is 1, "
right"
is 2, "
bottom"
is 4 and "
left"
is 8. Like this :
1
|---|
8| | 2
|---|
4
And then you go through each snake segments and add the values of the "
entry"
and "
exit"
sides. So any combination of entry and exits will give you a tile value between 0-15.
Your graphic file simply need to be in the right order. I don't have access to drawing tools, but it`s easy enough. A simple snake tileset would be :
Tile :
0 : empty tile
1 : tail/head coming from the north (because "
1"
is the sum of only one side)
2 : tail/head coming from the west
3 : north to west corner (because "
3"
is the sum of the north and west sides)
4 : tail/head coming from the south
5 : straight segment, north to south
6 : west to south corner
7 : not used (because "
7"
is the sum of 3 sides, and the snake will never touch 3 sides at once)
8 : tail/head coming from the east
9 : east to north corner
10 : etc... just add the side values together to know their shapes.
This technique works with drawing Snakes, path arrows, Drod's gates, or even to draw overworld RPG maps (it allows to quickly determine what tiles goes where based on it's surrounding)
[Last edited by Gutter at 12-03-2007 10:30 PM]