Creating Modular Powerup Systems- Game Dev Series 18

Objective: Create a script to modular 3 different powerup.

Previous: Determining How Long Powerup Effects Should Last

Next, we will create a speed boost powerup.

We can create a coroutine function to our Player script as what we done to triple shot. In this coroutine, we will increase the speed within the limit time.

Then we need a speed boost prefab to collide with Player.
A speed boost powerup is quite similar to triple shot powerup.

Same as drag in the basic sprite,

add a collider and a rigidbody.

And don’t forget the Powerup script.

However, since we only create one script for all the powerups, we need to make our script can identify which powerup that player just collided with.

To do that, we can simply make an easy-to-use modular for powerup.

Open the Powerup script, then create an integer variable called _powerID, and also make it a SerializeField.

As it shown in the comments, we will set the ID numbers to each powerup.

Then we can if statement to verify which powerup that we collided with.

Back to Unity, we can change the ID in the Inspector. Change the ID number to each powerups.

Let’s check if our player can really identify the powerups.

--

--

--

A passionate gamer whose goal is to work in video game development.

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

Recommended from Medium

Blazing Fast Distributed CI with Nx

8 Best Project Management Tools For Software Development In 2022

The Value of Liberating Structures for Scrum

Call Center and Soccer: Two of a kind

Deploy a “RemindMe” Reddit Bot Using AWS Lambda and EventBridge

The easiest way to run python

5 Ways to Learn a New Coding Language

Illuvium Dev Blog — October 2021

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
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

Day 105: Working with Animation Events in Unity

2D Mobile: Designing Enemies Using Abstract Classes

Virtual Cameras w/ Cinemachine in Unity 2020 — Part 4

Modular Health System in Unity!