08-30-2025, 01:30 PM
(08-30-2025, 03:28 AM)Jules Marchildon Wrote: I'm starting to work on a pac-man maze. I have a long road ahead of me with this challenge. I'm going with a technique I read up on using tiles that are setup as a grid that allows you to draw the maze dynamically. Each tile is stored in a 2D array. The maze is setup 28 across and 31 tiles down. The array elements are structures that allow you to include properties or attributes about the tile and can be used for game flow logic and drawing updates. I'm curious to know if anyone else in PB land has done any work in this area? TIA.
A picture of what I have so far... (obviously more work to be done )
I did something similar once, where I used an ascii text map.
Resolution can be whatever you like, of course.
As a simple example, this:
"__X__X__"
"_____X__"
"_____X__"
"XXXXXX__"
"__X_____"
Creation of the maze is visually simplified, and the array can be created directly from the strings.
The size of open areas and thickness of walls can be easily controlled by the number of array elements they employ.