I’ve done it! All of the game’s regular enemies have been designed and programmed! Next I’ll start working on the Interactibles, but for this post I’d like to take a look at the last regular enemy: The Wall. The Wall was designed to be a rare sort of enemy that wouldn’t show up until late in the game. The Wall is exactly what it sounds like – a huge wall that slowly advances toward the player. The Wall takes up the entire screen, and unlike the other regular enemies, takes three hits to destroy. Its only vulnerable point is its open “eye”, which moves each time it takes damage. Land three successful eye hits and the Wall comes down.
The programming was a little tricky here, but nothing too intricate. I just had to determine how exactly I wanted to go about programming it. I wanted the Wall to start with an open eye, and each time the eye got hit I wanted it to close and open in a different position. I didn’t want to just have it randomly choose a position, however, because I didn’t want the eye to close and then reopen in the same place. So, when the eye is hit, I have it check its y-coordinate to see which of the three positions it’s in. Based on that, it randomly rolls either a 0 or a 1 and then moves to one of the other positions. Each successful eye hit lowers the Wall’s health, and once that health hits 0, the eye changes its sprite instead of changing positions and follows the Wall offscreen.
I originally thought about ceasing all enemy spawns when the Wall appeared, as I was afraid that other enemies blocking the player’s attempts to shoot the eye would be unfair. After trying it out myself, however, I’ve decided that dealing with a Wall as well as other enemies is actually quite exciting! By itself, the Wall isn’t much of a threat at all, in spite of its size. It moves very slowly, and its weak points, in spite of their ability to change position, are large and easy to hit. Throw other enemies into the mix, however, and things get very complicated. Dodging bullets while this huge mass slowly approaches you is nerve-wracking in all the right ways. It’s not super hard, but it sure does put the pressure on and make the Wall a more intimidating foe.