How to stop animation?

NeoCHI

  • Posts: 524
I'm trying to implement a common death effect where when an enemy dies it fades out. I've realized I need to stop the enemy's animation when it fades out though other wise it looks weird.

Currently I'm setting the run time of the frame the animation is current at to something high, but this is hacky and also require me to stop using recycled actors which I believe is significantly effecting my frame rate.

Is there an better way to stop an animation at it's current frame?

twotimingpete

  • *
  • Posts: 1667
I'm not sure why that's stop you from using recycled actors.

Another easy/lazy way would be, I'd think, to get current frame for self and then set, under updating, the current frame to that frame.


JeffreyDriver

  • *
  • Posts: 2150
Image api? Create an image from the actor and fade that out?
Current Projects:
The Grand Grimoire Chronicles Episode 1 now on Kongregate!.
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

morphman86

  • Posts: 141
You can make a death animation for the actor that is just a single frame, or the complete animation that it had before, but without the looping (so it stops on the last frame of that animation rather than looping it back). If the actor could have one of several possible animations at the time of death, you can make a copy of each of those animations, remove the looping and then check when they die which animation they have and play the appropriate death animation.
Programming equivalent of Jack-of-all-trades

designpeg

  • *
  • Posts: 698
I had a similar problem with a number of actors that I needed to run animations in reverse on. I ended up putting each frame in a different animation and numbering them, then incrementing the frame myself.

It would be great if stencyl had a pause animation and/or reverse animation block.

Bombini

  • *
  • Posts: 1310
+1 on what twotimingpete said.
That works very well!

CmdrWhitey13

  • Posts: 503
+1 to Jeffery. Image API maybe best for this.

Upon death, create instance of image of self at position.
Kill self.
Fade instance.

Hope it helps.

greatanthony

  • Posts: 168
+1 on two twotimingpete.............just do that and set opacity to an increasing number for actor and after 1 second kill that actor................

LIBERADO

  • *
  • Posts: 2660
It would be great if stencyl had a pause animation and/or reverse animation block.
+1
   
Suggested now in the Issue Tracker: http://community.stencyl.com/index.php?issue=735.0
I'm spanish, excuse me for my bad English.
I'm not a private teacher. Please, post your questions in the public forum.

designpeg

  • *
  • Posts: 698
This is a bit off track, but, you could take a look at this extension http://byrobin.nl/store/product/spineskeleton-for-all-platforms-stencylopenfl/  for the excellent spine ( http://esotericsoftware.com).

I've been using Spine to create animations - exported as png sequences (I'm using the $69 version), but now with this extension, you can animate all your character movements, including things like fades/etc and just call them with a block. 

Movements can even tween into each other, (eg a run into a slide). Obviously, you also get the advantage of saving memory as the animation is skeleton based.

arpeggiudio

  • Posts: 1
(Sorry if this is necro, but wasn't sure if it was useful to make a new post for this?)

It's possible to set the duration of a specific frame (under Actors->Draw->set duration of frame)To pause an animation, you can set the frame to a very long duration. Works for my situation, hopefully this helps!