Hi,
My event is firing and it looks to have the correct data, yet I can't get it to work quite right.
private void addListeners() {
final EventData smash_impact_Event = Assets.instance.playerSkeletonData.findEvent("smash_impact");
animationState.addListener(new AnimationStateAdapter() {
public void event (int trackIndex, Event event) {
Gdx.app.error(TAG, event.getData() + ", "+smash_impact_Event ); //Fires, appears to be equal
if (event.getData() == smash_impact_Event) {
Gdx.app.error(TAG, "yes"); //NEVER FIRES!!
}
}
});
}
So that first error message prints "smash_impact, smash_impact"
and if I ask it for toString() instead, or any number of other things, they look like the same. Yet the following if statement never resolves to true.
Thanks,
Richard
But this works:
animationState.addListener(new AnimationStateAdapter() {
public void event (int trackIndex, Event event) {
if (event.getData() == Assets.instance.playerSkeletonData.findEvent("smash_impact")) {
Gdx.app.error(TAG, "This displays, if is true...");
}
}
});
So I have some Java scoping issue? I know it is remedial, but can anyone esplain to me? Would be much appreciated, thank you.