2D Shooter: New Enemy Movement

Sabrina Windsor
Aug 25, 2021

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!

--

--

Sabrina Windsor

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