You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pinball/lib/game/behaviors/animatronic_looping_behavio...

26 lines
565 B

import 'package:flame/components.dart';
class AnimatronicLoopingBehavior extends TimerComponent
with ParentIsA<SpriteAnimationComponent> {
AnimatronicLoopingBehavior({
required double animationCoolDown,
}) : super(period: animationCoolDown);
@override
Future<void> onLoad() async {
await super.onLoad();
parent.animationTicker?.onComplete = () {
parent.animationTicker?.reset();
parent.playing = false;
timer
..reset()
..start();
};
}
@override
void onTick() {
parent.playing = true;
}
}