Ending an animation

For questions about using Classic.

Post » Sun Jan 31, 2010 5:48 am

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:
B
1
G
2
Posts: 2
Reputation: 629

Post » Sun Jan 31, 2010 8:59 am

Destroy the animation once it is finished.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Sun Jan 31, 2010 9:06 am

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.

[code:25adfs6c]
+ 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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Jan 31, 2010 6:53 pm

Haha, yeah it is pretty art.
Thanks for the help but I've found that fade looks just as good as it being destroyed.
B
1
G
2
Posts: 2
Reputation: 629

Post » Sun Jan 31, 2010 11:32 pm

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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests