v3.1.0: adjusted logic for applying/removing paralysed state

fixes bugs where sprites might stay visually paralysed for a frame
This commit is contained in:
Evan Debenham
2025-03-24 13:31:55 -04:00
parent f593824f9c
commit abd6b494f2
@@ -361,9 +361,14 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
private final HashSet<State> stateAdditions = new HashSet<>(); private final HashSet<State> stateAdditions = new HashSet<>();
public void add( State state ) { public void add( State state ) {
synchronized (State.class) { //instant as it just changes an animation property that will get read later
stateRemovals.remove(state); if (state == State.PARALYSED){
stateAdditions.add(state); paused = true;
} else {
synchronized (State.class) {
stateRemovals.remove(state);
stateAdditions.add(state);
}
} }
} }
@@ -460,9 +465,14 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
private final HashSet<State> stateRemovals = new HashSet<>(); private final HashSet<State> stateRemovals = new HashSet<>();
public void remove( State state ) { public void remove( State state ) {
synchronized (State.class) { //instant as it just changes an animation property that will get read later
stateAdditions.remove(state); if (state == State.PARALYSED){
stateRemovals.add(state); paused = false;
} else {
synchronized (State.class) {
stateAdditions.remove(state);
stateRemovals.add(state);
}
} }
} }