frame events?
It seems like a very useful thing to be able to fire an event when a certain frame of a certain animation is reached.
I'll likely make my own thing in a test project and if it seems like a good universal approach maybe i'll add it to flixel
Eggu in the discord brought this idea to my attention, and I've thought about it before
Is this different than doing something like setting the callback variable in FlxSprite.animation / FlxAnimationController?
https://api.haxeflixel.com/flixel/animation/FlxAnimationController.html#callback
callback:(name:String, frameNumber:Int, frameIndex:Int) ‑> VoidIf assigned, will be called each time the current animation's frame changes. A function that has 3 parameters: a string name, a frame number, and a frame index.
Is this different than doing something like setting the
callbackvariable inFlxSprite.animation/FlxAnimationController?https://api.haxeflixel.com/flixel/animation/FlxAnimationController.html#callback
callback:(name:String, frameNumber:Int, frameIndex:Int) ‑> VoidIf assigned, will be called each time the current animation's frame changes. A function that has 3 parameters: a string name, a frame number, and a frame index.
yes, rather than a single callback that handles every frame change, this would be a specific event on a specific fame of a specific animation. This wouldn't replace the callback, only serve as another option.
Example: say frame 6 of the "attack" animation is when you want to check collision or play a sound or something, you would specifically listen for that and be able to remove it without affecting any other events or needing to change the callback that handles every other event.