This week I worked on the enemies being able to free roam if they can’t see the player and added a walk/run animation for the enemy.

Outside of the enemy I did add some target locations around the player (which are 4 arrows around the player) which is in case I want to change where the enemy targets but for now isn’t connected/ likely won’t be used.


These are the sections for the walk run animations of the enemy as I couldn’t get it working with the Manny animations initially so just made one for the enemy specifically. This simply casts to the enemy gets it’s velocity, gets the vectors length of that and sets it to the speed used for the Walk/Run blend space which is the same one used by the Manny one normally.

This is mostly the same spawn enemies function as before in the rooms parent class with the added call to the free roam function in the enemy class. This has a 0.1 second delay as if it immediately tries to call the function it wouldn’t work as it wouldn’t be able to find a valid move location.

This is the free roam function in the enemy which just has it move to a random reachable point in radius around the enemy location which on success calls the free roam function again.

Finally added on to the false condition of the enemy seeing the player it now calls to the free roam function to go back to roaming if the enemy loses track of the player.
This shows the enemy free roaming and following the player as can be seen in this it can be easy to lose enemies around corners as well. However ordinarily it still is the same as previously when walking around in the open it being much more difficult to lose the enemy.