Creating an Enemy with a Shield in Unity

Objective: create a new enemy type with a shield, the shield can take 1 hit.

First thing was to drop the shield sprite and change the color and the size to make it different from the player shield.

Then I added the collider and rigidbody components to detect the collision with the shield.

Next step was to duplicate the enemy prefab and create a new one called enemy_shield and add the new shield as a child of the new prefab.

After that I created a new script called enemy shield and added it to the shield shield object.

In the Enemy Shield script I added the OnCollisionEnter function to detect the collision between the shield with the player and the laser and destroy the shield.

And that’s it!!! Now we have a new enemy type with a shield.

--

--

--

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

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

Recommended from Medium

Angular on Azure — Part I

Descript for Windows is now available

How Important is DevOps for an App Development Company?

Devops is not an option for the telecommunications provider

Performance analysis using pyArango Part I

Cat’s Eyes In Python Turtle

A pair of pale yellow cat’s eyes on a midnight blue background

Midtype as a Firebase Alternative

A comparison of Midtype versus Firebase’s offerings.

How Python is Proving to be a Turning Point Language in 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
Rusben Guzman

Rusben Guzman

A Software Engineer passionate about game dev and interactive products with Unity. I consider video games to be the artistic expression of programming.

More from Medium

Player Health And Damage

Toss a Coin: Creating a Simple Distraction System (Game Dev Day 62)

Quick tip — Upgrading your Unity project to Universal Render Pipeline (URP)

Creating a material in Unity