There be Walls
Initial wall routines.
The way this works is you are in a room denoted by X, Y coordinates. Exiting left/right will change the X coordinate while exiting up/down will change the Y coordinate. Each coordinate is an 8 bit value, so it wraps at 0/255.
Starting with a room with 8 posts:
Draw a single wall from each post, going either up/down/left/right. To control the drawing, I'm currently* using the X coordinate for the top 4 posts and the Y coordinate for the bottom 4 posts. There's 8 bits per coordinate, so I'm using paired bits to control the direction. Walls can overlap, so you won't always see 8 walls.
- direction control
- 00 = up
- 01 = right
- 10 = down
- 11 = left
By using the room coordinates as the starting point for wall generation, you'll be able to exit right, up, left, then down and return to the room you started from.
For test purposes the joystick currently controls the coordinates, which are shown in the score. I shut my eyes and held the joystick in a few directions before stopping - results are:
* I plan to use the X-Y coordinates as a 16 bit seed into a 16 bit random number generator. To draw the walls I'll then seed the generated with the coordinates and advance it to the next random number (I might need to advance it 2 times, or even more, but whatever I use will be a fixed # of advances). That number will be split into the high and low bytes and those bytes will control the drawing of the walls.
NTSC
PAL - let me know if the score is visible on PAL TVs, I made need to shift it upward based on Stella.
Source
3 Comments
Recommended Comments