60 days to become a game developer. Day 49.

Hi. Here is a recap of yesterday, Day 49 of my 60 day challenge to become a Unity Game Developer!

Most of the day was spent in team meetings where we merged all of our pieces together, got on the same page regarding what our 2nd sprint will look like, pulled our new baseline from the repo, and did a retrospective for our 1st sprint.

After pulling everyone’s code in, here is what the game looks like:

Image for post
Image for post
Checkout the sweet laser and awesome boss!! Definitely on a talented team. I was testing with some of the weapons I created however aside from the laser, for time sake we will likely use the weapons that came with the project. May try to utilize one of them for the enemy I am creating today! Also, the enemy logic has not been set up yet which is why the boss is not taking damage or recognizing the collisions.

Another thing that we did yesterday was a session on abstract class. Abstract classes are a great way to optimize code by allowing for properties and functions to be inherited from a base class rather than having to write the same code over and over again. This is especially helpful when wanting to create different versions of the same thing. Let’s say for example you wanted to make a human abstract class. All humans eat, breathe, have an age, etc. so these are all properties and functions that you could put in your base abstract class, from there you can create all the different people you want by inheriting from your base human class and changing the properties and functions for each person you create.

We decided that this would be great for our enemies. We knew that there were things that all of our enemies would need i.e. speed, animators, weapons, etc. so we worked together to create an abstract class that we could inherit from.

Here’s how we approached this:

First we needed to come to an agreement on variables.

Image for post
Image for post

We decided that the best thing to do would be to set up our health (hp), speed, animator, colliders, and fire rate. All of our enemies will have these inherited and now all we will need to do is go in and set the values for each of our enemies. Also included on here are variables to handle the damage taken by the laser beam as this is set up to be handled in a slightly different way from the way the other weapons damage will be taken.

We then set up the functions:

Image for post
Image for post
protected virtual void allows access to the child classes and the ability to override any methods so that behavior can be modified.

Movement():

Because we are using this base class for our generic enemies, we decided to keep the movement very simple. Our generic enemy will just move to the side.

WeaponFire():

This instantiate a weapon as well as creates a fire delay.

Damage():

Our damage method takes in a parameter of _damageTaken and is public so that it can be called from the player’s fire class (i.e. laser, fireball, etc) this is likely where we will set the damage. We also destroy the object in this method once it’s hp is less than 0.

OnTriggerStay():

This deals with the laser behavior which sets a specified amount of damage for the laser as well as a delay while the damage is being taken.

Today I will be working on a new enemy!! Should be fun :-)

Will touch base soon.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store