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

To me, the interesting parts for this whole thing really come down to how to do the

My First CLI Ruby Project

Community Development Task — VitePay

Tips and Tricks to using PostgreSQL Docker Image

Kafka .NET Demo

How to Become Good in Programming

Main title of figure removed after print function is used

The Future of Jelly Beasts

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

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

My journey becoming a Unity game developer: 2.5D Infinite Runner-Ledge Grab System-Pt4

How to Win the Race Using Director

Realtime Procedural Audio and Synthesized Piano in Unity 3D