Ending an animation

This forum is currently in read-only mode.
From the Asset Store
Ninja char for your game! Make your own Shinobi game with this art.
  • Hello, I have just started using construct and have read part of the Ghost shooter tutorial.

    I'm trying to make gunfire but when it's made, it just stays there and repeats.It never ends.

    I want it to end once all frames are finished playing.

    Here is a picture:

  • Destroy the animation once it is finished.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • But you've made such pretty art, why would you want to ruin it?

    Anyway, you could try the Destroy action. Just be sure to uncheck Loop in your animation.

    + Gunfire: On animation finished
        -> Destroy
    [/code:25adfs6c]
    
    Or you don't even need to create the gunfire every time.  You could just use one sprite with a blank end frame.  Always stick it at the end of your gun, and point it in the same direction, then set the frame when you want it to play.  Make an image point for your barrel on the player.
    
    [code:25adfs6c]
    + Always 
      -> Set Gunfire position to Player (image point "barrel")
      -> Set Gunfire angle to Player.angle
    
    + On Control "Fire" pressed
      -> Gunfire: Set animation frame to 1
      -> Play animation
    [/code:25adfs6c]
    
    When it's done it'll stop on the blank frame and look like there's nothing there.
  • Haha, yeah it is pretty art.

    Thanks for the help but I've found that fade looks just as good as it being destroyed.

  • Just be sure to destroy it after it's faded out. Otherwise it will still exist, and if you have several thousand faded objects in your game then it might start to slow down.

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