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(
|
SpriteAnimation normal = SpriteAnimation.fromFrameData(
|
||||||
firework,
|
firework,
|
||||||
SpriteAnimationData.sequenced(
|
SpriteAnimationData.sequenced(
|
||||||
amount: 9,
|
amount: 10,
|
||||||
stepTime: 0.25,
|
stepTime: 0.25,
|
||||||
textureSize: Vector2(512, 512),
|
textureSize: Vector2(512, 512),
|
||||||
loop: false,
|
loop: false,
|
||||||
|
@ -170,7 +170,8 @@ class MyGame extends BaseGame with PanDetector, TapDetector, KeyboardEvents {
|
|||||||
bool shouldReset = false;
|
bool shouldReset = false;
|
||||||
|
|
||||||
void reset() {
|
void reset() {
|
||||||
if (!(runner.sprite.animation?.done() ?? false)) {
|
if (!(runner.sprite.animation?.done() ?? false) &&
|
||||||
|
runner.sprite.animation!.loop == false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
runner.sprite.animation!.reset();
|
runner.sprite.animation!.reset();
|
||||||
|
@ -218,6 +218,9 @@ class Runner extends Component with HasGameRef<MyGame> {
|
|||||||
@override
|
@override
|
||||||
void update(double dt) {
|
void update(double dt) {
|
||||||
super.update(dt);
|
super.update(dt);
|
||||||
|
if (sprite.position.y + sprite.size.y >= gameRef.size.y) {
|
||||||
|
event("die");
|
||||||
|
}
|
||||||
// If the animation is finished
|
// If the animation is finished
|
||||||
if (sprite.animation?.done() ?? false) {
|
if (sprite.animation?.done() ?? false) {
|
||||||
sprite.animation!.reset();
|
sprite.animation!.reset();
|
||||||
|
Loading…
Reference in New Issue
Block a user