Journal 152 — Unity Project Development, 2.5D Shooter

Objective: Add another player weapon and modify enemy power up behavior

In this article, I go over how I added one more player weapon power up. I will also go over how the enemy power up drops work.

Player Weapon

I decided to add another triple shot but change the look and make them do double damage.

To start, I modified the sprites in the prefab. I also made a new tag so I can check for collisions with this more powerful attack.

I kept the same components so I can reuse the same bullet scripts. In the enemy C# script, under the OnTriggerEnter function, I check for this new projectile, and I call the hit tracker twice.

Here it is in action.

Similar to the other weapon levels that were added previously, I updated the Player script with a new weapon level, a new prefab that would spawn on the Player, and a new sprite that would show on the UI Canvas.

Power Up Spawn

For the final version of the enemies, I want to spawn a power up on random enemies that are flashing. For a flashing enemy, I used the game object for flash damage. I tried some coroutines and update methods to make a repeating enemy flash, but it did not look consistent. I found that InvokeRepeating and CancelInvoke worked well. So I added a random number check or the enemy when spawned, and if that enemy was designated to drop power ups, then I would enable and disable the flashing game object.

In the Enemy C# script, I set the InvokeRepeating function, and then in the EnemyDeath function, I CancelInvoke.

Here it is in action.

Thank you for your time!

I want to look again at all the audio sounds and behavior, use the Unity Profiler to do some testing, and look at all the code organization before posting.

--

--

--

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Journal 96 — Unity 2D Mobile, Dungeon Escape Player Animations

How To Fix Meizu Pro 6s Not Charging [Troubleshooting Guide]

Blocking scam phone numbers starting with specific prefixes on Android

How Google’s FireBase can be used to build a completely functional iOS app?

All the 49 Keywords in Java Part 1

How To Fix Meizu 18 Pro Not Charging [Troubleshooting Guide]

Trainline’s journey to speed up the customer experience: getting set up

How To Fix Meizu U10 Not Charging [Troubleshooting Guide]

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
Chris Nielsen

Chris Nielsen

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

More from Medium

Journal 142 — Unity Project Development, 2.5D Shooter

Making a RTS game #48: Various fixes, improvements and clean-ups (Unity/C#)

A Series On Creating Immersive Audio in Unity with Custom Wwise Scripts

Diverging from Base Enemy Class