Not so much fixed as I played with a new script and got what I wanted. I was looking at different scripts trying to find a script for an entirely different problem and found one called AI Follow. The script I had been using for archer movement was AI Path and it had some problems (see previous entries). But AI Follow seems to have none of those problems and does pretty much EXACTLY what I want and even gives me a few new features to play with. Best of all I don’t need to give the object a rigged body to make it not clip through walls! This means it can stop on a dime and won’t have weird momentum problems when turning a corner.
Equally as important as finding that new script was figuring out how to get the player to look at the mouse pointer. One short internet search and I found exactly what I needed, just had to fiddle with it a bit to get the variable declarations in the right place and it works great. Only problem I see with this is that it gets me no closer to my goal of having both keyboard and mouse controls and controller support. But that is a fairly far off concern for now.
Now that I have three reasonably working enemies my next goals are going to be:
- procedural level generation
- player/enemy health
Archers now follow the player for a predetermined amount of time before holding still for another predetermined time. At first when the archer would be told to stop moving it would drift on the momentum it had gathered. This was simply solved so that when I turned off the AI movement I also set the character’s velocity to Zero.
The idea I was going for was an enemy that followed the player around and periodically shot a projectile. I also wanted the enemy to stop at a specified distance from the player. Unfortunately in my experiments with A* pathfinding I can either have the enemy stop at a specific distance or have the enemy not clip through walls. While I will continue to look for a solution for this problem the short term workaround will be to change the desired behavior to periodically moving before holding stationary and firing.
I have started a new game project. It is a twin stick dungeon crawler with procedurally generated levels. I have some basic room designs and basic character movement controls (going to overhaul them but current ones will do for now). Currently working on coding the enemies I have come up with and re-familiarizing myself with A* path-finding.
Goals for this project are:
Procedurally generated levels
Xbox controller and Mouse and keyboard controls
Randomly generated loot
Boss rooms every X floors