Game Dev in Progress… Day 31
Hello and welcome another blog post of my progress to becoming a game developer. Today, I started working on the first feature I was assigned to for the project. Before that however we did a meeting on how to backup our art assets so that way we didn’t lost any of it. This was being done by two other team members while I had my own job which was to handle backing up our coding using Git. After this I started working on designing and implementing the mid boss.
The first thing I did was to look at the game design document and understand what its asking me to do. Essentially, I was going to make a mid boss that appears half way through the level. This boss will have a two unique attack patterns and will take damage from the player. It will have health and once it reaches half way, it will introduce it’s second unique attack pattern. Every time it takes damage, there will be smoke particles or visual indicators that it has taken damage. Once it reaches zero health, it will blow up in an explosion and the player will continue on to the next wave.
After reading through and understanding the game design, I started to think about how I would implement them. To get some inspiration, I looked online and on Youtube for similar games. The first feature I wanted to tackle was the bosses movement. The movement script that I made was really simple. I simply randomized an x and y position within a range. That range I set between midway of the level and the end of it. Using these positions, I used transform.Translate method to move the boss towards that position. Once I reached, I randomized a new position again. This keeps looping until the boss is dead.
The next feature was implementing the first attack pattern. Since the boss was facing away from the player. I was thinking of creating a sort of bomb/mine that boss drops behind them. To do this I created a sphere game object as placeholder for the mine. I then created and programmed a simple script that would move the mine to the left of the scene. I instantiated this mine in my boss script and set a timer using a Coroutine to spawn a mine every 1 to 2 seconds. I also wanted to create a turret since I noticed that the boss had a turret at the bottom and at the top. I reused and modified some of the code I had from the 2D course and used it for this. Here’s a screenshot of the code:
To simplify it, I’m calculating the x and y direction I want to move using Mathf.Sin and Cos respectively. Then I instantiate the projectile and set the direction I want it to move. I have a start angle and end angle. If the I reach either of them, I reverse my angle of my bullets. This way I have a sort of area I want to shoot my bullets at. The last step is updating the angle so I can get a new direction. Here is the result of all the features I worked on today:
That was all I managed to do today. We had our afternoon meeting today where we showed off what we did. Ryan one of my team members was able to complete his feature. We did some Git stuff as well as did our first merge session today. This merge sessions will be more about handling our project so that way we can collaborate and not have any errors when we do our own features. I’m still confused about Git but hopefully it’ll get better as we do more of it. I plan to finish up or at least try to do most of the mid boss tomorrow and move on to the wave system.
_
Cristian Aspacio