2D Shooter: New Enemy Movement

Objective: Create new movement patterns for the basic enemy.

First we’ll want to make a new int variable to keep track of movement types.

We’ll want to assign a random number to it in the start method so that a new number gets assigned every time the enemy is instantiated.

Now we’ll want to create a switch statement in the CalculateMovement() method so that the corresponding pattern gets called. I will make the current pattern into the default case, while using sin and cos for the other cases to make a wave and circle pattern.

And now we’re done!

--

--

--

Currently learning to code with the help of GamedevHQ in order to someday my my game ideas come to life!

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

Recommended from Medium

TCG World — Dev Updates & Product News

More value wide ahead toward activity.

Being a senior software developer

Maximize Business Performance with Risk Management Software

How to Install TIG stack (Telegraf, Influx and Grafana) on Ubuntu

Coinlegs Signals Market Place

Version:1.0

BlogPost_22

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
Sabrina Windsor

Sabrina Windsor

Currently learning to code with the help of GamedevHQ in order to someday my my game ideas come to life!

More from Medium

Optimizing the Animator and Callouts

Quick tip — Shortcuts to make level design easy in Unity

2.5D Platformer: Moving Platforms

Variables! — The building blocks of programming