The Path of the Game Dev — Day 10
Onto the next Phase.
Today started with working on a pickup with negative consequences when the Player runs into them. Since I made a powerup that slowed the enemies, why not make something similar for the Player?
But just slowing the Player didn’t seem cool enough… so I made it into a temporary halt of the Player’s movement. Not punishing enough to totally take agency away from the player, but enough to make avoiding these pickups important enough. I might also work on a visual that looks like an electric shock to further signify the Player’s halted movement.
Also worked on developing a shield for the enemies. Similar to the Player’s shield mechanic, the enemy shield absorbs one hit of damage before dissipating. Attaching the shield to the enemy was easy enough — I did the same thing as the Player’s shield by making it a child object of the enemy.
However, once I did there were several interactions I had to correct before it could work properly. The first thing I had to do was make sure the enemy lasers did not destroy the shield. Since I had the behavior for the enemy lasers within the script for the Player’s lasers, I wanted to find an alternative to making a whole new script. I differentiated between “Laser” and “EnemyLaser” to fix it. No more enemy lasers running into their own shields!
Another interaction I had to fix was that destroying the shield would not preemptively destroy the enemy. To do both of these things I had to change the damage system on the enemy. Originally it activated OnEnemyDeath whenever the enemy was damaged, which played the explosion animation and destroyed the enemy object. To solve this problem I created a health system on the enemy that would allow the enemies to take one hit before exploding.
Biggest takeaways from the day: If you want to change code you’ve already written down, make sure it doesn’t explode first.