diff --git a/assets/images/fireworks-frames.png b/assets/images/fireworks-frames.png index 34b5899..0e994c2 100644 Binary files a/assets/images/fireworks-frames.png and b/assets/images/fireworks-frames.png differ diff --git a/lib/firework.dart b/lib/firework.dart index fccbe50..543fdcc 100644 --- a/lib/firework.dart +++ b/lib/firework.dart @@ -19,7 +19,7 @@ class Firework extends Component { SpriteAnimation normal = SpriteAnimation.fromFrameData( firework, SpriteAnimationData.sequenced( - amount: 9, + amount: 10, stepTime: 0.25, textureSize: Vector2(512, 512), loop: false, diff --git a/lib/main.dart b/lib/main.dart index 498ac5e..4332daa 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -170,7 +170,8 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents { bool shouldReset = false; void reset() { - if (!(runner.sprite.animation?.done() ?? false)) { + if (!(runner.sprite.animation?.done() ?? false) && + runner.sprite.animation!.loop == false) { return; } runner.sprite.animation!.reset(); diff --git a/lib/runner.dart b/lib/runner.dart index cb7f7a5..1060b6a 100644 --- a/lib/runner.dart +++ b/lib/runner.dart @@ -218,6 +218,9 @@ class Runner extends Component with HasGameRef { @override void update(double dt) { super.update(dt); + if (sprite.position.y + sprite.size.y >= gameRef.size.y) { + event("die"); + } // If the animation is finished if (sprite.animation?.done() ?? false) { sprite.animation!.reset();