Day 3 – Lose!
Development time: 200 minutes (running total: 520 minutes).
Don’t worry! It isn’t lose as in development-failure, just that the loss condition is now implemented so it is possible to lose the game. Today’s development was steady and I covered most what I wanted again, with a lot less problems than yesterday. I even made a quick fix to my collision issue before work thanks to a tip from Doolwind.
I spent a while cleaning up the enemy spawning script, and fixing a bug in which enemy transform and rigidbody properties weren’t properly reset during recycling, causing them to spawn in unintended locations. Once cleaned up, the enemy spawning script made a decent starting point for the scientist spawning script, I just had to remove some unnecessary timing elements and make a few adjustments.
I added some extra walls to keep the enemies in, and added inert box colliders to the spawners to make their scale visible, since I’m using it determine the area in which to spawn things.
With the scientist spawner able to determine when all the scientists have been attacked, it was time to add some higher-level choreography to the scene. I created a basic game control script that keeps track of game state and game mode, with a few methods the spawners can hook into to report important events (enemy and scientist deaths). I added a display for score (just the number of enemies killed at this stage), and a simple label to indicate game over state.
Finally, I had the game controller hook into the enemy spawner and start turning things up as the score increases, for basic difficulty scaling in survival mode. This only works up to a point, as the enemies have a lot of trouble once they start to pile up, but it’ll do for now.
|Increasing difficulty (still needs some work).|