Bugs.

KT
2 min readDec 16, 2020

Today I spent the morning fixing some old bugs that were bugging the hell out of me (lame pun intended).

The first problem I tackled was my enemies firing lasers after they were killed, exploded, and incinerated. At first I liked that they shot off one last death-throw-shot right when they turned to space dust but then I realized it might not be as fun for anyone who might play the game and not yet know a death-shot was headed their way. In order to allow the enemy explosion to play out completely, we had modified the enemies so that their collider is removed immediately upon being hit so that they can’t cause any more damage but they were set to destruct 2.8 sec later, after the explosion could fully play out. However, since all the enemies were “alive” 2.8 sec longer than they should be, they were still randomly firing off lasers. So I went back in with an if-statement that only allows enemies with Collider2Ds to fire off lasers. And that problem was solved.

Next, I moved over to the player. I had never implemented the player exploding upon dying. I had saved it for later and later had become today! No time like the present. For this one, I used the existing explosion animation that is played by the asteroid upon being hit with a laser. I added a serialized field to the player and dragged and dropped the explosion animation prefab. The prefab itself already had the explosion audio so that wasn’t needed. I then instantiated the explosion prefab when player lives < 0 and that one is done now too!

The rest of the morning was spent going over my enemy and laser scripts, trying my darnest to remember what I did and trying to figure out the parts I didn’t understand. A lot of the upcoming tasks have to do with modifying enemies and if I don’t understand them, I can’t successfully modify them.

After lunch I got back to work on the Phase II tasks and decided to tackle the “Press C to attract Powerups” task. Since I have separate scripts for regular and rare powerups, I had to redundantly update both scripts with the same code. I used .MoveTowards( ) and even though I still can’t get it to quite work with my homing missile, this was a success! Check me out below attracting ALL the powerups:

I likes allllllll the powerups… except the skull.

--

--