How do I play animation properly

Get help using Construct 2

Post » Tue Apr 29, 2014 1:34 am

I have the code below set up. It works the animation plays but each frame loads in back of the previous frames. They all stay on the screen. I assumed they would each show for only 1 second or so and stop and the end.

Any suggestions would be great.

screenshot.jpg

mole.jpg
You do not have the required permissions to view the files attached to this post.
B
8
S
1
Posts: 62
Reputation: 660

Post » Tue Apr 29, 2014 2:33 am

Think of you entire event sheet as a one big loop. Each frame goes through the event sheet once.

What is happening your case is each frame the event is Creating the Mole object and then setting the animation. So if you game is running at 60 frames per second, you are creating 60 new mole objects each second.

I hope that makes sense.

IF you want it to just happen once, you can deactivate the Mole1 group after you set the animation. Then it won't happen again until you activate the group again.

There are better ways to handle what you are trying to do, but my suggestion should work.
B
100
S
32
G
11
Posts: 1,552
Reputation: 21,612

Post » Tue Apr 29, 2014 2:42 am

I believe what you see is the result of new sprites being created every tick on top of each other and playing the animation with a phase difference of one tick (so you see all the frames overlaying).

You can confirm that easily with the debugger, just see the number of objects, it should increase rapidly over time.

This is happening because when the condition '"is Group "mole1" active" becomes true, it stays true, thus performing the same actions over and over again.

Add a "system | Trigger once while true" condition below the "is Group "mole1" active" condition, to make sure that you create only one "Mole9" object.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Tue Apr 29, 2014 2:45 am

Beaten at the finish line :)

But the "trigger once while true" should be also valid.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Tue Apr 29, 2014 11:44 am

Thanks ArcadEd and Eli0s. I'll test that out tonght.
B
8
S
1
Posts: 62
Reputation: 660


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Casimir, pwrtoppl, resdesign and 9 guests