Hi everyone,
Is there currently any way to cancel or pause a flipbook sprite animation started with msg.post("#sprite", "play_animation", {id = hash("anim_id")})
?
I would like to pause or stop an animation on the current frame when a player takes a hit or is stunned for example.
Thanks
britzl
February 28, 2018, 3:12pm
2
No, not at the moment. We’ve discussed a system where you’re able to get a cursor or something like that to control the playback. But it’s so far only discussions and no concrete implementation work.
1 Like
OK, Thanks a lot for the info.
Pkeod
February 28, 2018, 5:42pm
4
You can put the sprite inside of a collection loaded via a collection proxy and then set its time step to be zero for as long as you want the pause.
Attached example
paused_char_example.zip (3.1 KB)
This can also be used for slow motion effects.
If you add a very tiny freeze frame to the entire game when attacking / taking damage it can make the game’s damage feel very impactful.
4 Likes
britzl
February 28, 2018, 8:44pm
5
Quite clever! But if you use physics there’s problems with different physics world.
1 Like
Pkeod
February 28, 2018, 8:45pm
6
If it’s a problem then would need to keep the go with the physics collision object in the main world, and then put the go with the animations in the collection proxy collection, then sync the positions as the game goes.
1 Like
@Pkeod : This is nice, and definitely an approach I wouldn’t have thought of.
I stumbled accross this thread and ended up controlling animation manually in a simple module:
Once an animation is defined from a group of images in the Outline of an Atlas, I can set its FPS to a value I like, however I couldn’t find a documented way to programmatically control sprite sheet animation speed.
I’m thinking about two work-arounds: defining animations with suffixes like run_10fps, run_11fps, run_12fps, etc for different FPS and switching between these animations programmatically - which will most likely cause animation cycle synchronisation issues; alternatively - I can try…
Thanks a lot for the help!