fixed some minor bugs, and implemented fireworks fully.
This commit is contained in:
parent
d56f87fef0
commit
eb7491a852
Binary file not shown.
Before Width: | Height: | Size: 470 KiB After Width: | Height: | Size: 472 KiB |
@ -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,
|
||||
|
@ -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();
|
||||
|
@ -218,6 +218,9 @@ class Runner extends Component with HasGameRef<MyGame> {
|
||||
@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();
|
||||
|
Loading…
Reference in New Issue
Block a user