Hi,
I've tried to get Events working in my Libgdx game and can't figure it out.
I followed the Events video and documentation, I tried to add the AnimationStateAdapter listener like this:
state = new AnimationState(stateData);
state.addListener (new AnimationStateAdapter() {
public void event (int trackIndex, Event event) {
System.out.println("Event: " + event.getString());
}
});
With the above code, I would have thought that any time an event happened with this skeleton, it would print out the String value of the event to the console (however I don't get anything printed to the console at all).
My animation displays properly, I checked the exported JSON file and found the event in there and I'm using the latest versions of Spine (3.6.36), Libgdx (gdx-1.9.6) and the Spine Runtime (spine-libgdx-3.6.34.0).
Am I missing something simple?
Cheers,
Mike.
Silly mistake, I've figured it out already.
After looking at the source code for the AnimationStateAdapter, the parameters for the event method are (TrackEntry entry, Event event) instead of (int trackIndex, Event event) in case it helps anyone else.