I want to make a feature in my game where you can draw on a TileMap, and an arrow would appear in the tilemap.
The arrow can bend, make u-turns, and overlap itself, but not go diagonal.
I use different sprites and place those on the tilemap. I can rotate them to create all sorts of different arrows. Below is a list of the description of each piece, and what directions have exits in their default rotation.
I'm mostly stuck on figuring out the proper data types to store this stuff. I've got a pretty good idea on how to program things like the neighbour checking, but I want some advice on how to structure this data.
If anyone know any related tutorials or resources that addresses this, please let me know! I can't seem to find much when searching for something like 'drawing arrows on a 4-way grid'
These are the pieces:
enum { START, END, STRAIGHT, OVERLAP, CORNER, DOT }
The START piece is what the start of the line. It replaces the DOT piece once the DOT piece has gained a neighbour. The START piece has a connection in the NORTH direction.
The END piece is a pointing arrow. The arrow points in the opposite direction of it's connection, which is in the NORTH side. (the arrow points SOUTH by default).
The STRAIGHT is a straight piece. It has connections towards the NORTH and SOUTH side.
The OVERLAP is two straight pieces that overlap. Connections are NORTH, EAST, SOUTH, WEST, where NORTH->SOUTH is the 'above' route and EAST->WEST is the 'below' route.
The CORNER is a corner piece that has two connections, the NORTH and EAST side.
The DOT is a dot. This piece has no connections, and is used when no neighbours are connected.
How would I best make a script that draws arrows like in my example picture on the tilemap?