How: Make enemy "wander" in area

Get help using Construct 2

Post » Wed Sep 25, 2013 3:45 am

Top down zombie shooter:
How do I make zombies wander around in a given area?

Pathfinding behavior seems too specific as it only goes to one location. This is good because I can make it destroy a door, but once the door is destroyed, I want the zombie to enter and wander around looking for the next thing to do (break windows, break more doors, break walls, find player)
Check out my games on Google Play:
BEAST ATTACK (1,000,000+ downloads!)
ZOMBIE BASH (Android) (Launched Feb 17)
ZOMBIE BASH (iOS) (Launched March 17)
B
54
S
18
G
2
Posts: 436
Reputation: 5,582

Post » Wed Sep 25, 2013 3:46 am

Here is my cap file
https://dl.dropboxusercontent.com/u/73836006/zombie.capx
Check out my games on Google Play:
BEAST ATTACK (1,000,000+ downloads!)
ZOMBIE BASH (Android) (Launched Feb 17)
ZOMBIE BASH (iOS) (Launched March 17)
B
54
S
18
G
2
Posts: 436
Reputation: 5,582

Post » Wed Sep 25, 2013 4:26 am

you could do pathfinding, but when he gets to a new location, he starts calculating the next location. Zombies like to linger a little, so you could do something like. On arrive at location, wait 3 seconds and start to calculate next location. Just an idea
B
35
S
5
Posts: 411
Reputation: 3,406

Post » Wed Sep 25, 2013 8:29 am

You could randomize the forward movement and angle of movement. Also move towards a point. Will give a wandering effect. If you ever get to the point you can just randomize a new target point within a given range.

EDIT: Had some time so put the example together. Every now and then exhibits a bit of mob mentality, but explains the idea.

https://dl.dropboxusercontent.com/u/79803565/Wandering%20Zombies.capxAngelEyes2013-09-25 20:53:18
B
13
S
4
Posts: 67
Reputation: 1,270

Post » Fri Sep 27, 2013 12:23 am

[QUOTE=AngelEyes] You could randomize the forward movement and angle of movement. Also move towards a point. Will give a wandering effect. If you ever get to the point you can just randomize a new target point within a given range.

EDIT: Had some time so put the example together. Every now and then exhibits a bit of mob mentality, but explains the idea.

https://dl.dropboxusercontent.com/u/79803565/Wandering%20Zombies.capx[/QUOTE]

This is great! Thanks. However, it's not following the player as much as I want to.
Check out my games on Google Play:
BEAST ATTACK (1,000,000+ downloads!)
ZOMBIE BASH (Android) (Launched Feb 17)
ZOMBIE BASH (iOS) (Launched March 17)
B
54
S
18
G
2
Posts: 436
Reputation: 5,582

Post » Sat Sep 28, 2013 6:34 pm

add something like Line of Sight, when they get close make them follow your guy.
B
12
S
3
G
1
Posts: 347
Reputation: 2,866

Post » Sun Sep 29, 2013 3:34 pm

There was a plugin called Running away or something, look it up, it does just that- random going around
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,377


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests