How do I make every instance of an object trigger an event?

0 favourites
  • 4 posts
From the Asset Store
Game Triggers is as versatile as a Swiss army knife, and will be a great resource for any type of game you're creating.
  • How do I make every instance of an object trigger an event?

    So these events will let an enemy do damage to the player and display a text sprite amounting to the damage done..

    imgur.com/a/QUZm4

    It does what I want.. kinda. Except when a huge number of enemy objects does an attack (at the same time and even just a few frames apart) the event doesn't execute for every enemy..

  • Your events are in the wrong order, if I'm not mistaken.

    Currently you have :

    IF (Enemy is not dead ; Enemy is attacking ; Frame = 4 ; Trigger Once)

    THEN for each enemy

    IF Is trgtInAtkRng

    DO something

    Meaning if ONE enemy meets the conditions for the first IF, you are checking the range of each enemy, when you just want to check the range for this particular enemy.

    Also : as long as an enemy meets this condition, since you have a Trigger Once, it won't happen again. If a lot of enemies are attacking, at all time you could have at least one with the AnimationFrame = 4, and that would block everything.

    Try the events like this :

    FOR EACH Enemy

    IF (Enemy is not dead ; Enemy is attacking ; Frame = 4 ; Is trgtInAtkRng ; Trigger Once)

    DO something

    Now each enemy should be independently checking its own Attack Range when the conditions are met and shoot only once

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The damage and text are spammed when multiple objects' conditions overlap..

    here are the events

    imgur.com/a/hss5c

    and a screenshot of the WIP

    imgur.com/a/3WjCF

  • This one gives the best output by far but still doesn't trigger the event for every object on huge numbers.

    imgur.com/a/Z99Bw

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