Pac-man enthusiasts, rejoice! I have you made you one attractive and fully playable level.
The end results of Programming are, of course, all lollipops and rainbows. But I’m here to tell you about the frustration that precedes the satisfaction.
Behind-the-Scenes Hair-Pulling Moment Number 1: Designing a stage.
I knew that Pac-man’s maze needs to be not too basic and not too complex. It should be symmetrical and nice-looking. It needs to accommodate moving characters and fit within 480 x 360 pixel screen area. And since would be controlling movement with numbers of pixels, I knew it would be to my advantage to make the most mathematically regular system of paths units as possible.
Pulling all these requirements together was harder than I anticipated, and I spent a lot of time on failed attempts. In the end, I built a grid of blocks in Illustrator, drew a stroke that went through only the exact centers of blocks (Smart Guides, I love you), and adjusted the width of that stroke until there seemed to be a nice path/wall thickness ratio that fit both my screen dimensions and the size of my characters. Success.
Behind-the-Scenes Hair-Pulling Moment Number 2: Pellets.
Oh, they were easy enough to draw. But I did spend nearly an hour placing them equidistant on my nicely-drawn paths by inputting coordinate values. See the first part of this code? I had to come up with 128 different values for those.
Behind-the-Scenes Hair-Pulling Moment Number 3: Pac-man’s Movement.
The $1,000,000 question is: How do you keep Pac-man on the path and from munching his way through walls? I examined a number of different Scratch projects to find the answer, and there are actually many different ways of doing this, each with various glitch potential. All made use of the “color # touching color #” functionality, but this played out quite differently depending on how the arrow keystrokes were programmed. Does the right arrow key aim a perpetuum mobile Pac-man in an easterly direction? Or does it inch him there at a prescribed distance? Where is the colored pixel that determines whether Pac-man has hit a wall, and should he bounce back in this event or simply halt? I experimented for hours with all these options and came up with functionality that is infrequently glitchy, but still not perfect. Sigh.
Behind-the-Scenes Hair-Pulling Moment Number 3: Ghost Movement.
Thankfully with the ghosts, I didn’t need them to do anything special like think for themselves or chase Pac-man. I simply gave the illusion of random movement by preprogramming three different cycles of movement around the stage that were decently complex. Each ghost has a script that begins something like this…
… and continues on for at least six times the length you see here.
Conclusions? I obviously can’t bring myself to create an ugly game, regardless of the low number of viewers and even lower number of players it will have. Beauty takes time and thought. And for beauty, I’m always ready to give both!