Enemy AI with 2 players

Get help using Construct 2

Post » Sat Oct 19, 2013 10:43 am

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.capxAustris2013-10-19 11:42:41
B
4
Posts: 21
Reputation: 273

Post » Sat Oct 19, 2013 7:02 pm

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

Thanks hope that it helps.
B
96
S
20
G
15
Posts: 198
Reputation: 14,571

Post » Sat Oct 19, 2013 8:16 pm

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
B
13
S
4
Posts: 67
Reputation: 1,270

Post » Thu Oct 24, 2013 10:07 am

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 .
B
4
Posts: 21
Reputation: 273

Post » Fri Oct 25, 2013 9:33 am

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

Good luckAngelEyes2013-10-25 09:34:06
B
13
S
4
Posts: 67
Reputation: 1,270

Post » Mon Oct 28, 2013 12:10 pm

Thx man!
B
4
Posts: 21
Reputation: 273


Return to How do I....?

Who is online

Users browsing this forum: DolyGamesCosmos and 30 guests