Phase 2: PowerUps Destroyed by the Enemy

Objective: Give the Enemies the ability to detect if a PowerUp Collectable is in front of them and the ability to fire a laser to destroy before the player can collect.

First I will create a layer for the powerups, this will be used in the RayCasthit2D.

I will created a method called CheckForPowerUps(). This will check for anything on the powerup layer, using the RayCasthit2D. If a powerup is detected the FireLaser() Method will be called.

I will add the CheckForPowerUp() Method to the update Method.

Let’s see this in action

Happy Coding!

--

--

--

Unity / C# Game developer

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

Recommended from Medium

Cloud Face Recognition for Mobile Applications: Design and Implementation

How MQTT CHAT android messenger is perfect for dating apps.

Is Google Evil? Our unjustified removal from Google Play

Implementation of Firebase In-App Messaging in Android development

We Recommend Material Design Components

Storage Roadmap: Targeting Android 30

Is Kotlin better than Java?

3 Free Ways to Run Android Apps on Your PC

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
Bill Rislov

Bill Rislov

Unity / C# Game developer

More from Medium

Adding a thruster speed boost on keypress

What is Filebase and How do you use it?

Creating a Moving Platform in Unity

More Productive Editor Layout in Unity