Enemy AI with 2 players

  • I'm making a Beat'em up game like little fighters and i have successfully added the 2 player function like in little fighters where player one has WASD controls and player 2 has arrow key controls.

    I have all the behaviors on the Shadows of the characters.

    So i have got to the most hardest part of making a game (as they say)-

    Adding AI.

    I want the enemy to stand in place until player(s) get close to him and then go and attack the player who's closest to him.

    Capx:https://dl.dropboxusercontent.com/u/158606470/PublicCapx3.capx

  • I think as far as I know , you can add one square sprite covering the player and a little bit more, so when the enemy overlap this sprite then the will start reacting. Maybe there is another good way but I am not very experience with C2, that's why as a noob I am giving you my way of solution. Just to get you started <img src="smileys/smiley1.gif" border="0" align="middle" />

    Thanks hope that it helps. <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Check out collisions with offset in the sprite actions. Look at line of sight behaviour if there are obstacles and you want the players to be able to hide behind them.

    Good luck

  • Thanks guys,this helped me alot,but i can't seem to figure out how the enemy will decide witch player to go and attack,like i want him to chose the one who's closest to him .

  • Austris I have created a small demo that will hopefully point you in the right direction.

    Good luck

  • Thx man!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)