Game Dev in Progress… Day 14
Hello and its the 3rd week of my training to become a game developer. This weekend, I took the time off to unwind and get some of my technical problems sorted out. I recently got a new PC but sometimes it would randomly freeze and then work again after a few seconds. I’m hoping its fixed now because I haven’t had any freezes yet so fingers crossed. Other then that my weekend was pretty great. Now lets focus on what I did for the day.
First thing in the morning I fixed a couple of bugs within program that I didn’t catch the first time around. The bug that I found was that my Unique Enemies would get destroyed when they get instantiated. I don’t know how I missed such an important bug but I did… The way I resolved it was that I needed change the tags of my game object enemy lasers so that the lasers won’t detect the enemy object as an enemy. I found another bug as well that would shoot my lasers backwards and all I needed to do was reverse the line of code for that logic.
The second half of my day was to work on the Enemy Pickup feature. This feature revolves around the enemy detecting a power up and shooting it’s lasers to destroy it. So my first problem was to find a way to detect the pickup. I already partially worked on this the last week and came up with using RayCast2D (I talked about this on the last article). The second step was to fire my lasers at the pickup. This took me a bunch of tries because I wanted to make my code compact by modifying the normal shoot laser method. After giving a try, I eventually gave up on that idea because the logic behind my normal shoot laser method just wouldn’t allow the logic that I wanted to do without redoing everything. So instead, I created a method, specifically a coroutine that would fire the laser once and then wait for a couple of seconds and then fire again if the pickup was still alive. Finally I just created the code for destroying the pickup when it is hit by the enemies laser.
Overall this was a pretty hard day. I took me too much time trying to work around the code I already instead of just accepting that it wouldn’t work. So this was a valuable lesson to not get to hang up on something even if you want to make the code efficient. Deadline are there for a reason. Thank you for reading!
_
Cristian Aspacio