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

Geofencing in Android

The 5 Most Formidable Free CRM solutions you can get your hands on right now!

AWS SNS & SQS with practical example

Liskov Substitution Principle

Plant Taxonomy Viewer — Command Line Interface App.

Python Dictionaries

SDK Guide — Friends System

Creating a high availability cluster with AWS CLI

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

How to Create A Loading Scene in Unity

Making a 2.5D Character Controller in Unity Part 2

Using GameDevHQ’s FileBase Asset Database For HQ Models

Learn to code by making 2 D space shooter.