Why is all the instances imitating first one?

  • 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.

    [attachment=0:3pc0atnr][/attachment:3pc0atnr]

    Thank you for all kind of help, now off to make some food.

  • 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.

  • 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.

    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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)