Day 4 – totally playable
Like day 2, progress was slower today than I had hoped. I spent longer than I meant to and didn’t get get everything done. Unlike day 2, however, I am quite pleased with my progress. The difference? Today’s extra time was all spent making things more awesome!
“And just what is so awesome about it?” I hear you ask. Well, First off I added a class to keep track of a campaign game: things like current level, surviving scientists, and some variables related to enemy spawning rate. The campaign class made implementing campaign mode in the main controller as simple as creating a campaign object and hooking it up to the enemy spawner. The main controller still choreographs level transitions and handles all the menus.
|Main Menu – I’ve been ambitious and presumed I’ll manage to get a tutorial level made this week.|
On the topic of level transitions and menus, I spent a while beefing up the UI. There is now a proper menu with a few game modes, pre- and post-level overlays, and a game over overlay. Using overlays with a simple button to proceed saves a little development time compared with choreographing the peri-level events with coroutines, and is fine for my purposes. Even so, messing with fiddly GUI code often takes longer than it seems it should, but that’s not where all the time went.
|Start your engines!|
I also spent a while messing with the spawners, particularly the enemy spawner, to make the game flow for campaign mode simpler. Both spawners can now remove all the objects they’ve spawned ready for the next level. Enemies had a tendency to pile up when they were spawning individually in random locations, so I changed the enemy spawner to spawn waves, with enemies distributed more evenly along the top of the play area. I also added an interface to the enemy spawner that describes some values related to spawn rate. By implementing this interface in the campaign class, the game controller can link the current campaign object to the spawner and they can sort things out among themselves, but I keep the flexibility to hook the spawner up to other implementations for a different spawning experience (e.g. for controlled spawning in a tutorial level).
|HUD, and spawn waves|
Finally, I messed with enemy activation so that their corpses hang around for a sensible time before disappearing. This was necessary since they appeared to be teleporting when they were recycled, and they could be recycled almost instantly, which was somewhat jarring. This will not be such an issue when spawning is moved off-screen, but who knows when I’ll get around to that?