Enemy ai
Root / Programming Questions / [.]
KomodoCreated:
Enemies in the NES era traditionally had very basic AI, take for example The Legend of Zelda. Every single enemy had either very linear AI (e.g. move towards player at constant speed) or random AI (e.g. move randomly and change direction every x frames), or some combination of the two (e.g. appear in a random spot and fire towards the player, then disappear).
These things are quite easy to program to be honest, and depending on your game, are likely to be very fun to play against. If you strive for more advanced AI, there is no one right way to do it. You seem to know what you want the enemy to do (get close to play, attack with sword), it's not so hard to code. Code it, see how it behaves, then think about ways to improve it - or maybe you'll think that it's fine the way it turns out!
You change the speed by changing how far the enemy travels in a fixed amount of time.
What you'll want is for the enemy to home in on the player at a certain range, yes? You will need to have either a sight collide box or a presence like collide box on the player. When whichever connects, have it home in on the player. The method for something like that, which does it most well is the "A* path finding algorithm". Something I hope someone else will elaborate on because I currently have no clue how to implement one yet, ha. Trying to understand it myself.
so i need to make a collision box around the character using somthing like sphitsp and every time the enemy hits it he attacks with the sword hmm i think i like that idea(you know three weeks ago i whould have had no idea how to do that but now i do) i think i will also for harder enemys make a projectile like a knife or arrow fly at the charecter if they are on the same x mark or y mark if you know what i mean but first i will give the player a shield so it's not to difficult. I have a plan now thanks guys for your ideas you are a huge help.