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

View File

@@ -361,9 +361,14 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
private final HashSet<State> stateAdditions = new HashSet<>();
public void add( State state ) {
synchronized (State.class) {
stateRemovals.remove(state);
stateAdditions.add(state);
//instant as it just changes an animation property that will get read later
if (state == State.PARALYSED){
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<>();
public void remove( State state ) {
synchronized (State.class) {
stateAdditions.remove(state);
stateRemovals.add(state);
//instant as it just changes an animation property that will get read later
if (state == State.PARALYSED){
paused = false;
} else {
synchronized (State.class) {
stateAdditions.remove(state);
stateRemovals.add(state);
}
}
}