Repair Your Ship- Game Dev Series 37

Objective: Create collectable repair powerup gameobject.

In this article, we will create another powerup to repair our Player.

There are 3 steps we need to complete:

  1. Create a gameobject with all the needed components.
  2. Make this as a powerup prefab.
  3. Activate it in code.

Create gameobject with needed components.

As usual, drag in the sprite of our repair powerup in to Hierarchy. Add necessary components to it.

And also create the animation to make it alive!

Create a prefab

Once all the setting is done, drag it back to Project as a prefab.

Activate it!

Now we can start to activate it.

Open the Player script, we need to create a public method to change the live counts with powerup.

We’re not only update the live counts and UI, but also update the damage sprites.
Therefore, we need to extract the damage visual effect switch statement as another method: DamageSprites().

In this method, we need to turn the effects on and off on specific statement.

Then we can call the AddLives() method in the Powerup script.

Our AddLives() now should assign 4 as its PowerID.

All done! Now you will be fixed during the game.

--

--

--

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

Prod++[3]: Leaner Search Using DuckDuckGo !Bangs

Leetcode — Stone Game

Our quest to make world-class security and bugfinding available to all developers, for free

Utah Lawyers

utah lawyers

Kubernetes Patterns: 1. Predictable Demands

Setup Kubernetes Cluster Multi-tenancy with AWS EKS

Using AWS to unzip all of Wikipedia in 10 minutes

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

What is a Control Track in Timeline

Modeling An Elevator Console With Unity ProBuilder

Unity : AI && NavMesh [FSM : (Finite State Machine with Enum)]

Adding a burst laser powerup