how to draw tunnels

1. when a character digs tunnels

Place a bunch of rocks around the character and move the rocks from one side to the other side as the character moves so that the character always sees rocks in front of him to whichever direction he goes. The program stores the location of him into the array, tunnel_loc#, whenever he digs one unit in darkbasic coordinate.

outside view:

inside view:

2. when a character runs through tunnels

Display tunnels by drawing series of rings of rocks as shown in following pictures. We take the points in tunnel_loc# as the center points of the rings.

outside view:

Inside view:

Pick the rings visible in the current scene. If they are not in the array, old_tun which holds the IDs of the rings visible in the last scene, we draw each ring checking if any part of it is located inside of other rings - when two tunnels intersect each other, some part of rings are inside the others so that we don't draw that part. In the meanwhile, we remove the rings which are out of the current scene from old_tun and add the rings which are newly drawn.