How do I correctly make three instances of the same object act indepently?

0 favourites
  • 6 posts
From the Asset Store
Footsteps SFX Three contains 540 sounds of steps and jumps on different surfaces.
  • Hi there, thank you in advance for taking a read. Hopefully, I explain myself well enough and don't come across as an idiot!

    So, in our game, our enemy has an instance variable called Phase. We use this to advance the enemy through its various motions, animations and attacks.

    However, we have one location that has three enemies in and all of them act in sync all the time. Regardless of whether the conditions are met within each phase (Screenshot attached)

    In this example, the "OctoSpitter" is meant to activate when you're within a short distance of its X and Y coordinates. However, if one of the "OctoSpitters" does the spitting animation. All of them do the animation.

    How do I correctly make these little blighters act independently?

  • Using the "For Each" system condition usually solves this type of issue.

  • Thank you for replying oosyrag, really appreciate it.

    So would I place the For Each above all of their phases in one big loop? As when I try to do that it hangs the game completely ... I must be doing it incorrectly.

  • Hmm it's a little hard to say, it depends on what you're trying to do and I haven't really wrapped my head around your logic.

    But basically you use it when you want to have any particular action(s) apply for each instance of an object, instead of for all of them at the same time.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Gotcha, thank you so much. So I have amended the code and used the Pick by Comparison for each 'Phase' and then a for each underneath this and it looks to be working perfectly.

    Thank you!

  • you don't need a "for each", the issue is that you're not picking the OctoSpit in phase 2, you're picking player, so all OctoSpît will do the same as the Octospit that'S in phase 2 with the smallest IID

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