Why is all the instances imitating first one?

Get help using Construct 2

Post » Mon Apr 21, 2014 5:45 pm

I have finally gotten the enemy movements down pat, that got some sleeping on the code for my part, I think I even dreamed on how to solve it.

When there's only one instance of it, it works well! Following the edge of other tiles.

But when I added a few more enemies in same level, suddenly the other enemies are just imitating the first instance, doing exact same movements as that one. When I want them all to do their own moves independently.

Maybe I should add some kind of loop to my events?

Or maybe I am missing something? Obvious, probably. :)

events.png


Thank you for all kind of help, now off to make some food.
You do not have the required permissions to view the files attached to this post.
B
58
S
18
G
13
Posts: 447
Reputation: 10,735

Post » Mon Apr 21, 2014 6:04 pm

Whenever you find instances not behaving individually, it's because the operation in question needs to be broken down to run individually. This is where 'For each' comes into play. From what I can see, you should do your Pick 'punk' first, followed by by a 'For each', and then do your 'Facing' test where each will be tested individually.
ImageImageImage
B
71
S
21
G
232
Posts: 3,695
Reputation: 129,866

Post » Mon Apr 21, 2014 10:00 pm

@blackhornet Thank you!!!
It definitely made this to work a little better.

Hmm. It is kind of working. Yes enemies are moving on their own, but now the movement is a little more irregular than if it was a single one. hmm. Sometimes it won't even move. :P

Ah well, back to stare at movements, noting down what's problematic. ;)
EDIT: It is so random. It also feels a little "choppy". hmm. I wonder if it breaks the Else. Or if the "second" object is sent in the events processing before the "first" one is finished. hm.

EDIT again..
Ok not "little choppy" but "Much choppy". It really stops the game for a while occassionally. I wish I could add breakpoints to within loops for debugging!
B
58
S
18
G
13
Posts: 447
Reputation: 10,735

Post » Mon Apr 21, 2014 11:06 pm

Edit again, I compared again with one enemy, with the same "map" as the many enemies and it appeared that the logic was a little lacking. I added another option and now it seem to work. Save for the cpu eating. ;)
B
58
S
18
G
13
Posts: 447
Reputation: 10,735


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 60 guests