Phase 2: PowerUp Collection

Objective: When the “C” key is pressed by the Player the PowerUps move towards the player quickly.

Power Up Collection

The first thing I will need to do is create a reference to the Player. This will be used to get the position of the Player.

Next, I will create a Method that will get the position of the player and subtract it from the powerup position to create a new vector3 call _direction. Also, I will normalized the _direction to create a much smoother movement. the last thing to do is subtract _direction from the current position and move at three times the normal speed.

Now that we have the method complete we need to check for the “C” key and call the Method.

Checking for the C Key

Let's see this in action

Collection PowerUps Demo

Happy Coding!!




Unity / C# Game developer

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

Recommended from Medium

Chrome Trace Profiling Tool with Python

Robot Assembly — ELEGOO

Befriending legacy

An old typewriter to represent Legacy projects

Ethanim Meta GPU — Metaverse Image Computing Solution


A simple way to combine FCM notification with TTS

2 most important lessons about Clean Architecture

Part 1: Electrical design for Control systems

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

Creating a Moving Platform in Unity

Tap & Hold & Rapid Prototyping w/ New Unity Input System

Loading Scenes In Unity

Adding a thruster speed boost on keypress