Updating Enemy Movement AI

Out Of Bounds Fix

I had to fix the out of bounds conditions. I had to add the cases for the other game move directions.

Set Move Direction

I also fixed the set move direction so it takes in account all axises.

I added a random move direction on the X Axis so the enemy will move back and forth on the screen.

I then Added the case to check if the enemy is moving accros the screen.

I added in an amplitude so I can control how far it moves back and fourth.

Next I added a frequency to control how fast it moves back and fourth.

I then add a way to randomize the amplitude and frequency so every enemy will move differently.

--

--

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
James Lafritz

James Lafritz

147 Followers

Excited about changing my hobby into a new carer with GameDevHQ course.