How do I Keep From Spawning More Than One Projectile?

  • Everything is fine when I set the projectile to spawn right at the moment of key press-- I get one projectile per press.

    ____________________________________________________________________________________________________________

    Function | On "Shoot" | Player: Set animation to "Fire", Spawn "Projectile" on layer 1 (image point 1)

    ____________________________________________________________________________________________________________

    However, with the animation that goes along with it, I don't want the projectile to spawn until frame 3.

    So I set it up as a new, separate event:

    ____________________________________________________________________________________________

    Function | On "Shoot" | Player: Set animation to "Fire"

    Player | Is animation "Fire" playing|

    Player | Animation frame = 3 | Player: Spawn "Projectile" on layer 1 (image point 1)

    ____________________________________________________________________________________________

    And now on each key press, five or six projectiles are spawned from animation frame 3!

    Like I said, this only happens when I restrict it to a specific frame.

    How can I make it so that only one projectile is spawned per key press, on the frame I want?

  • Well the frame lasts longer than one tick..

    So every tick the frame is playing, a projectile is spawned..

    Adding a system trigger once while true condition should suffice..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, it worked!

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