How do I play animation properly

0 favourites
  • 5 posts
From the Asset Store
3 pixel charaters with over 8 animations each + animations with a gun
  • 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.

    [attachment=0:2fmocoyh][/attachment:2fmocoyh]

    [attachment=1:2fmocoyh][/attachment:2fmocoyh]

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • Beaten at the finish line

    But the "trigger once while true" should be also valid.

  • Thanks ArcadEd and Eli0s. I'll test that out tonght.

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