Phase II Progress Report — New enemy type Minelayer

In this article, I am going to go over the implementation of the new enemy I have introduced. The minelayer.

The enemy circles down the screen while dropping mines at random intervals.

The mines will gravitate towards the player if they get too close so this enemy I one who causes a lot more hassle later in the game when in bigger numbers as they can render the field difficult to maneuver

In order to prevent repeating code for any more future enemies, I have refactored the initial enemy into an abstract class.

Minelayer

The minelayer enemy is just an alien spaceship asset I download and converted to 2d.

I used a sine and cosine wave to have the enemy circle its parent game object (which moves slowly down the screen). I won't delve into the maths behind it but remember SohCahToa from school to help decide which wave have you need to assign to each vector.

Now, this enemy is moving I just needed to assign a simple script to have the parent game object move down the screen.

Mine

The role of this object is to take up space and slow down the player (and cause damage if the player gets too close).

The mine will move towards the player as soon as the player gets into range and will continue to chase (slowly) until the player moves out of range. The player can destroy these objects with any weapon. If the mine touches the player it explodes and causes damage.

Now we can see this object in action.

That’s all for now.

--

--

--

Unity developer with a love of learning all things programming.

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

Recommended from Medium

Download Original Files from PipeBio

Farewell to cold winters, and hello endless summer in Sydney

OPEN API FOR BETTER CUSTOMER CONNECTION AND SMOOTH WORK FLOWS

Software Design Pattern: Prototype

Connect Celery and RabbitMQ with Django

integrate celery and rabbitmq to django

Attr_reader vs. instance variables

Ascent to a Higher Place

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
Luke Duckett

Luke Duckett

Unity developer with a love of learning all things programming.

More from Medium

Importing Character Models and Animations from Mixamo into Unity

How to the Layered Lit shader to mix Texture Maps in Unity HDRP

Unity : Cinemachine and Timeline (Part I)

Where’d He Goooooo…