Phase II Progress Report — New enemy– Sniper

In this article, I will discuss the new enemy I have added, the sniper.

The sniper enemy stays at the top of the screen to avoid direct collisions with the player and will shoot accurate bolts at the player and powerups alike.

The sniper is a rare spawn but can cause a lot of pain if not taken out early.

The implementation of the enemy was quite simple. For the movement, I randomly assign a Y height for the enemy.

It then makes its way to this point with a check to see when it arrives.

When it arrives at the correct height it activates another function which makes allows the sniper to strafe between its min and max range on the x-axis.

The enemy casts a ray when it is able to attack. This ray looks for powerups and players and fires a shot when one is found. After every shot, there is a random cool-down period before each next shot.

Now we see it 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

Developments mistakes I made and you should too

Why do engineers not care about application monitoring?

Front-end Monitoring: How to Enhance Modern Browser Performance — Sematext

Founder Stories: Why We Built Api2Pdf

Pure CSS: Accessible Checkboxes and Radios Buttons

Automatic jump cuts with TimeBolt and Premiere Pro

Adapting API Gateways over Legacy Systems

Spring Boot: Using Liquibase to load test and demo data

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

Quick tip — Enabling post-processing in Unity Universal Render Pipeline

Set Lasers To Destroy

Learn to code by making 2 D space shooter game.

Day 94: Wall Jumping in Unity