Today I started adding enemy AI. I found a tutorial about adding a simple AI to an object to make it attack when the player is in range.
The tutorial, unfortunately, used JavaScript, however, someone put the C# 'translation' of the script in the comments. I copy/pasted it into a script called "EnemyAI" and set the main camera to be the 'player' that the enemy attacks.
Now the enemy moves towards the player once it's within a specific distance. Unfortunately however, the enemy sometimes seems to drift to the side after the player moves out of range, instead of stopping completely. There's nothing I can do about it right now, so I'll have to leave it for now.
Next class I will add a damage mechanic. At some point, I'll also have to refine the raycast system. I still haven't been able to make it cast a single ray on click.
No comments:
Post a Comment