Enemy tutorial

I am doing a stickman project game and I Already did the character walk cycle and the enemy walk cycle. The Main player is the stickman and the enemy is the ant. How can I program the ant to be against me and hit me?

The blend file is here:
character + rig walk animation+simple main Menu+ boomrang throw+ant test .blend (863 KB)

If the blend file starts with the MainIntro Scene, just go to the Game scene.

Please help.

Im very very very new but this is something Im gonna be working on next and I think its going to involve some A.I. for your ant. Im thinking its involve a near sensor, ray sensor and an Edit object track to sensor. Say if your ants near sensor goes make the ant track to you and use a ray sensor to face you and do its attack.
I think for attack and damaging, your ant could do his attack animation then send a message containing subject “attack” and value of “damage” property to its target; then on receipt of this, your player has a message sensor for subject attack, uses python module controller “S2A.firstbodytovalue” and a property actuator that takes that value and subtracts from players health.

I hope someone with more knowledge comes in and schools us, because thats an outline in my head but I cant tell you how to make it all work, except the message sending/receiving part, thanks to Prof. Monster I learned to use S2A firstbodytovalue. If Im wrong or right on anything please chime in, Im here to learn, thats why I posted, this is what Im gonna be workin on next.

First you need to answer this to questions by yourself. Because these questions are very very general and vague anything would be an answer e.g. “throw a stone at the ant to make it angry - and the ant will be against you”. But I assume such answers do not help you, isn’t it?

Go into the idea inside your head and write down what the enemy should do under what conditions e.g.

  • if a player is near I go to the player
  • if I collide with the player bite

So you see that is much more detailed… but still leaves some questions:

  • How does a the object identify a ‘player’?
  • What means ‘near’?

If you know this details, we can help much easier (maybe you see the solution already). We can also provide solutions for this questions.