Creating a “negative” powerup

GameDev Dustin
5 min readJan 23, 2022


Sometimes its good to add a challenge to the player based on the instincts the game has forced them to develop.
In our case, all powerups are good powerups, so grab them!

But what if we add a powerup that actually hurts the player?
The player will have to be discerning from now on which makes for more interesting gameplay.

Since I don’t have a clear idea of what negative effect I want to add to the game, I decided a good way to brainstorm the idea would be to browse through my Clean Flat Icons package from the Asset Store and just import anything that looked like an interesting placeholder art.

The different designs can evoke ideas and ultimately, whatever I decide to do, I will need an icon to represent it anyways, so…win-win.

This is what I had to choose from after importing anything that seemed interesting and potentially useful for this game.

One of the first ideas that comes to mind is the various shield icons I have.
I could create a negative powerup that removes the players shields.

Since I’m especially devious, I’d also add a similar looking shield powerup that add 1 power to the shield.

The more they resemble each other, the better in my opinion, so I choose these two.

We create a game object for each using the chosen icons and rename them as appropriate.

I gave them some coloring.
My initial instinct was to make the negative red, but I felt that would be too obvious and easy for the player to avoid so I went with an orange for the negative powerup.

I need to assign each of these a _powerupID, so I pulled up my Powerup script and looked at what my next numbers would be.
I updated the comments for the variable for future reference.

Next we add our powerup script to both of our new game objects, assign the correct PowerupID, sorting layer, and make sure our Transform values are defaulted to 0,0,0 position and rotation.

Then I went ahead and childed them to the Powerups container since this is where they will be assigned.

Next I went ahead and created prefabs even though I have some more work to do with them.

Directly on the newly created prefabs, I added rigidbody2D and CircleCollider2D() components.
Make sure to enable Is Trigger and change Gravity scale to 0 on each.

I checked the default collider that was automatically generated and they looked good, so no change needed there.

The last component we need to add to both of these new powerup prefabs is the audio source component.
While we’re at it, we add the correct audio file to the Powerup Script component on them as well.

The last component we need to add to both of these new powerup prefabs is the audio source component.
While we’re at it, we add the correct audio file to the Powerup Script component on them as well.

Modifying the Player script

We’ve got 2 new behaviors we need to implement.

The first will add 1 shield power on pickup if shields are active but not if shield power is already full.

If shields are not active, we will add a weak version of shields.

Instead of the full 3 shield strength they will have 1 shield strength.

The second will remove shields altogether if picked up.

The code for these actions will take place on the Player script, but will be triggered from our Powerup script.

We add a new method, AddShieldPower() to our Player script.

We update our shield power based on our defined premise and make sure to update the UI representation of shield power when we are done.

I’ve also modified our ShieldActive() method to take an argument so that we can customize the amount of power added directly on this method.

Modifying our Powerup script

Updating our Powerup script is pretty straightforward.

We call our new AddShieldPower() method on the player script for our “6” case statement and call our existing ShieldDeactivate() method on our “7” case statement.

We also need to add an argument to our ShieldActive() call in our case 2 statement.

Modifying the SpawnManager script

We’ll need to add a couple coroutines for our new powerups.
I’m sure there is a more elegant way to do this, but for now I’ll stick with what is working.
This is just a prototype after all.

Last we need to use StartCoroutine to call our new routines from the SpawnManager’s StartSpawningWave1() method.

That’s it, check it out!