Event Action Execution Trouble Shooting

0 favourites
  • 6 posts
From the Asset Store
Shoot balls to destroy as many blocks as possible, at each stage the game will become more difficult.
  • I have been having some problem with the Event that I'm working on. Basically the game has multiple units of the same sprites. When an action say a bullet hits on one sprite, it will trigger an event, say an animation. The problem I noticed is when two bullets hit 2 sprites at almost the same time, only one sprite will execute the event while the other does not. But if the actions are done one after another more than 2 seconds apart, there is no problem. I am not sure but I suspect it has to do with the trigger once action that I included in the action.

    The action had a trigger once while true (it is needed because if I remove this part, the following animation trigger will persist continue on and on which I do not want even though I have assigned a line that says "On animation finished, do next action", it didn't work). Is there anyway to mitigate this effect so the system treats these 2 similar sprites as separate and execute separately? Please help. Thanks

  • What is the condition you used and added trigger once to, was it 'is overlapping' ? Use bullet on collision with sprite, that triggers once and helps to pick the sprite.

  • Yes, Plinkie, you were right! It was on "overlapping". Changing to "on collision" solves the problem. However a new problem pop up where the subsequent animation kept looping. Ok, here's the event sheet of how it looks like:

    Line 1

    Bullet on collision with Enemy > Enemy set instance variable "Shot" to true.

    Line 2

    When Enemy: "Shot" is true :

    Set animation to "A" (play from beginning)

    Wait 3 sec

    Enemy set ReadytoExplode to true (boolean)

    Line 3

    When ReadyExplode is true; System" "UpgradeGun" = 1 :

    Wait 3 secs

    Set animation to "B" (play from beginning)

    Line 4

    On animation "B" is finished, set animation to "C"

    So basically when enemy get shot, it plays animation A and then proceed to play animation B after X seconds (depending on the UpgradeGun score). After animation B is finished, it should move to animation C. However, my problem is animation B kept looping and can't transition to animation C even though Line 4 says on animation B finished. When I put trigger once to Line 3, it solved the problem (meaning animation B transition to C successfully) but when multiple enemies get shot at the same time, only one managed to complete to animation C while the rest keep looping.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • With the trigger once event also add a for each enemy.

  • Tried that. I wonder why it didn't work. The "For each" command should have designated each sprite as separate individual. I wonder what went wrong. I have tried as many combinations as I can possibly think of, replacing trigger with "For each" and vice versa, putting them together, in different lines, the outcome is still the same. Without the "trigger once" command, all the Enemy's animation cannot transition to the next animation and kept looping when hit about the same time. But with the "trigger once", only one Enemy can successfully transition when multiple Enemies are hit about the same time. Oh, Lord... :'''(((

  • Never use "Trigger once" when multiple object instances are involved. Events like "Enemy overlapping bullet, Trigger once..." will cause all kinds of bugs and problems! Same goes about using "Trigger once" inside triggered events, loops - don't use it unless you absolutely certainly know what you are doing.

    You need to post your project file or a screenshot of your events.

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