How do I make enemies following path dispersed?

Just started using Construct 2? Post your questions here

Post » Sun Apr 26, 2015 5:26 am

I've got multiple enemies on screen following the player. After a while, the enemies overlap each other and become one. What I want is for the enemies to leave spacing between each other while following the player. It doesn't even have to be complete spacing but enough space between the enemies that you can see most or all of them, when the player is moving.

Here's the CAPX: https://www.dropbox.com/s/07p9ovqjltvmu ... .capx?dl=0

Simply drag the control stick in the bottom right and after little while, you'll notice the enemies will begin to overlap each other and become one. Unfortunately.
Risk Rocket now available on Google Play
Image
B
36
S
15
G
6
Posts: 337
Reputation: 6,300

Post » Sun Apr 26, 2015 6:32 am

First (untested) thought is to give each of the enemies a slightly different speed so as the enemies are chasing the player they will form a sort of line from fastest to slowest. Something like :-


on start of layout
for each enemies : set bullet speed to random(50)+125

or

on start of layout
for each enemies : set bullet speed to 125+(loopindex*3)

?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Sun Apr 26, 2015 6:51 am

or set each enemy with a variable so it limits it's turn angle ?
or a combination of the two so you get fast enemies that cant turn fast and slow enemies with a smaller turning circle ?

quick test - https://dl.dropboxusercontent.com/u/143636437/examples%20for%20web/ball%20chase%20edit.capx
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Thu Apr 30, 2015 11:44 pm

This is quite something! Thank you Ram, I'll keep experimenting with this.
Risk Rocket now available on Google Play
Image
B
36
S
15
G
6
Posts: 337
Reputation: 6,300

Post » Fri May 01, 2015 4:02 am

This behavioral issue is a fairly common one and if you search the forums you will find some pretty complex ideas to stop the overlapping problem. Hopefully one day someone with better programming skills than me will write a behavior that works like the solid but for instances/sprites.. a swarm or grouping behavior... or even a repel overlapping objects that also have repel behavior.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest