"Trigger once" not working as expected, please look.

0 favourites
  • 5 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • So, I have this logic (check the attached screenshot)

    When the "block's" travel distance is >50 then it triggers once to spawn another "block".

    Problem is, after it spawns 1 block it doesn't continue to spawn.

    What I want is to have the "block" spawn another "block" EVERYTIME the "block" traveled 50.

    [attachment=0:1j2kikl3][/attachment:1j2kikl3]

  • Use a variable (named distance50 here).

    foreach bullet :

    each tick : bullet.distance50 = bullet.distance

    when bullet.distance ≥ 50, bullet spawns block and sets bullet.distance50 to 0

  • This isn't the right place to use "Trigger once" -- distance traveled won't magically reset after your bullet goes 50 pixels, so the condition is true and remains true, thus trigger once runs exactly once, as designed.

    What I'd recommend is to give your block an instance variable, called "spawnCount", perhaps. Then do something like this:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Linkman2004's solution is more elegant than mine by the way

  • This isn't the right place to use "Trigger once" -- distance traveled won't magically reset after your bullet goes 50 pixels, so the condition is true and remains true, thus trigger once runs exactly once, as designed.

    What I'd recommend is to give your block an instance variable, called "spawnCount", perhaps. Then do something like this:

    Thank you very much, this worked

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