Hello there! Here is a recap of days 47 & 48 of my 60 day challenge to become a Unity Game Developer!
This weekend I didn’t spend too much time on the project but I was able to create another weapon and started to work on a third. Not sure if any of these will make it to the final game but wanted to at least create a few prototypes so we have some options.
Take a look :-):
The first thing I changed was switching out the automatic firing system which used raycast for an Input.GetKeyDown so that the player fires using the spacebar. I then moved to creating the weapons.
This first weapon I created is a rapid fire laser. I created a prefab and a new script as I knew I wanted it to instantiate a different color every time and in order to do this, I wanted to access the sprite renderer so that I could set its color. Originally I set it to completely randomize the color but what I found was that I got a lot of really dark colors which made the laser fire hard to see. I ended up creating an array of colors instead.
At the very wise suggestion of my partner, I changed the colors to what is shown in the array above vs what you see in the gif so its not so “unicorny” lol. I also slowed the fire rate a bit.
Here is what it looks like now:
It instantiates in a pretty similar way to the other weapons with the exception of it’s fire rate and input method. In order to use this laser you have to hold the space bar down. This is how I implemented it.
I also added in a bool to switch between the two input methods. The bool is switched to false in the weapon right after as well as the first level weapon.
Another change that might need to happen is another switch statement to handle user input. If the team ends up with multiple weapons all needing its own different way to fire the weapon i.e. some you hold down the key, others you don’t, multiple keys, bools, etc., it may makes sense to create a whole separate method that gets called in update rather than placing all the logic there.
The other weapon that I started is a weapon that I want to be a protective barrier around the player. It works by instantiating the object and it rotating around the player and destroying any enemies that come into contact with it. I’d also like to add in some logic that destroys the instantiation after a few seconds so that there is some sort of chance for the player to get hit by the enemy weapons.
I only worked on this a little bit so right now what I have is the movement logic that makes the weapons rotate but I still need to get it to rotate around the player and create some sort of delay (Time.time or Coroutine) to destroy the weapons a few seconds after it instantiate.
Here’s what it looks like:
Excited to keep working on the weapons as well as see the cool stuff my teammates are creating.
See you soon!