How do I Add zombie AI, to my top down shooter

Get help using Construct 2

Post » Wed Oct 14, 2015 6:36 pm

I know it may be basic, but I cant do it. I have been trying to get the enemy (Zombie) To basically, when it see's the player (has los) it will follow it, but if it doesn't have los, then veers off randomly. I will be having multiple enemy's and I dont want them all to be in the same place so they're overlapping. Any ideas?
B
3
Posts: 2
Reputation: 182

Post » Wed Oct 14, 2015 6:39 pm

+or a way so that the zombies only move toward player when player is within certain distance to zombies, otherwise they just move around randomly
B
3
Posts: 2
Reputation: 182

Post » Wed Oct 14, 2015 8:36 pm

You should build a network of path nodes in your maps that the AI can follow when they are not alerted by the player. Sort of like a patrol route, of areas you want them to go.

You can add a Line of site behavior to your zombies, and have it check for the player every few seconds.
https://www.scirra.com/manual/163/line-of-sight

Also, you can use A* pathfinding for the zombies to seek the player, and for them to follow the path node network you made.
https://www.scirra.com/manual/154/pathfinding

There are other pathfinding plugins in the Completed Plugin forums

For the attack and patrol states, you should make a state machine.:
https://www.scirra.com/tutorials/1139/h ... e-machines
B
29
S
8
G
4
Posts: 767
Reputation: 5,985

Post » Wed Oct 14, 2015 10:57 pm

Here you go! Also with capx included.

https://www.scirra.com/tutorials/474/pa ... e-of-sight
B
14
S
5
Posts: 110
Reputation: 1,338


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests