shouldRemove property
Component will be removed after animation is done and the current state is true on removeOnFinish.
Note: SpriteAnimationGroupComponent will not be removed automatically if loop property of SpriteAnimation of the current state is true.
Implementation
@override
bool get shouldRemove {
final stateRemoveOnFinish = removeOnFinish[current] ?? false;
return super.shouldRemove ||
(stateRemoveOnFinish && (animation?.done() ?? false));
}
Whether this component should be removed or not.
It will be checked once per component per tick, and if it is true, FlameGame will remove it.
Implementation
bool shouldRemove = false;