Looking into adding animation events in my point and click framework.
Specifically want to hook function calls to specific frames in an animation (to play footsteps sounds or other things).
Is the cursor position (converted to frame) going to be enough? Any other option?
I’ve been wondering this for a while, as Godot has the ability to call functions from within an animation player component. I found this thread from last year where it appears the only real way to accomplish this in Defold is:
- use Spine animation events
- chain animations and scripts together with code
- or use the timer module
It’s a shame it’s still so difficult to accomplish this in Defold.
Well from that discussion there is now the cursor api here:
This will give you the current normalised cursor position of a sprite animation playing. Getting the current frame and launching an event should be trivial.
Describing these timeline events though I’ll have to do it from scratch and will probably require a small editor.
Ah, so the cursor, in this case, is like the cursor in a text editor or a dataset - the current, moveable index within a given range, not a visible, moveable indicator that tracks with the mouse. I was confused as I wasn’t sure how getting the cursor (mouse) position would help with determining the current frame of an animation. Thanks! I’m really interested in how you go about solving this.