So you made your game and you’ve got some weapons, but you think that they just aren’t enough. Well create some more, and make them different than the ones before. Repetition can be boring. Let’s break the monotony!
Let’s make a SUPER LASER!
You’re limited on time and need some new art but you aren’t the art guy, or you just don’t want to make something else right now. Well, then why not take an already existing asset and mold it into something new?
In this example, I took the art assets that I was already using for my ship’s thrusters and changed their color/shape in order to simulate new visuals for my Superbeam laser.
I then created new custom animations for the Superbeam by creating 2 new animations where I recorded the scaling of the object positively along the Y-axis and another that scales it back down. Then I added a mask to the area beneath the player to prevent the Superbeam’s Y-axis scaling from being seen below the player. But scaling an object with an animation also scales its collider. So I had to set a custom offset for the collider while the Superbeam is playing and reset it when it’s done.
Add this coroutine to the “Player” script along with a call to activate it whenever you want it to be triggered. In my game, I turned it into another powerup that activates once picked up.
This is the Superbeam prefab object. You will need to set this as a deactivated child object of the “Player” game object. and don’t forget to cache the reference to this object on the “Player” script within the hierarchy.
You can create all kinds of alternative weapon systems for your game. Another example could be heat-seeking missiles. All you have to do there is create a replica of your regular shots, but change the movement part of your missiles script to include the code logic seen below.