Stopping spritesheet looping on key presses

hello all,

been a damn long time since ive been here. doing a lot of chartiy work of late, have recently moved to leeds [wooo, took long enough ;)], dont have the internet and all other stuff :wink:
so im getting back on the horse of coding since ive been away and really been wanting to do some things. plus make some projects ive put off.

im working with @singmajesty library spritesheet - which is great. but how can i stop the animation looping/starting again if a key is held down - it has a machine gun type affect if the key is held down. ive tried just things like making bools to make sure just it just fires when i press down, and it kind of works, but does still does not stop the animation from doing this quick machinegun type looping.

the animation is set to loop, but just dont need the effect of the animation stuttering when the key is held down

thanks if anyone can help

Hey Lewis :smile:

I believe the idea with the library was that you would “showBehavior” an idle behavior (which could be just one frame) when you want it to pause. This would finish the current behavior, then stay at idle. Would this work?

hmmm. well really if i would stop my key presses, or would just want idle animation, it would be perfect. but im really looking for animation happening once pressing keys

is there another way around. i guess i could do a json sheet, or something similar. but if there isa haxe library, then thats better :wink:

I have a system to control animations that calls AnimatedSprite’s update( ) on my own internal update loop. Then it becomes really easy to pause / resume by toggling a bool and bailing if ( isPaused )

PS I am looking into adding something to the sprite sheet lib that mimics MovieClip behavior, but I need to clear it with my company first or write a new one from scratch in my own time, so this will take a chunk of time. Just noting that I hope to contribute before the year’s out.

2 Likes

that would be awesome. many thanks - will look forward too it

but to add. that would be super duper uber awesome :wink: