mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 03:15:43 +08:00
Merge branch 'v1.0.0' into erick.assets-refactor-2
This commit is contained in:
@ -29,47 +29,40 @@ class MyGame extends BaseGame with TapDetector {
|
||||
animation = SpriteAnimation.sequenced(
|
||||
chopper,
|
||||
4,
|
||||
textureWidth: 48,
|
||||
textureHeight: 48,
|
||||
textureSize: Vector2.all(48),
|
||||
stepTime: 0.15,
|
||||
loop: true,
|
||||
);
|
||||
}
|
||||
|
||||
void addAnimation(double x, double y) {
|
||||
const textureWidth = 291.0;
|
||||
const textureHeight = 178.0;
|
||||
final size = Vector2(291, 178);
|
||||
|
||||
final animationComponent = SpriteAnimationComponent.sequenced(
|
||||
291,
|
||||
178,
|
||||
size,
|
||||
creature,
|
||||
18,
|
||||
amountPerRow: 10,
|
||||
textureWidth: textureWidth,
|
||||
textureHeight: textureHeight,
|
||||
textureSize: size,
|
||||
stepTime: 0.15,
|
||||
loop: false,
|
||||
destroyOnFinish: true,
|
||||
);
|
||||
|
||||
animationComponent.x = x - textureWidth / 2;
|
||||
animationComponent.y = y - textureHeight / 2;
|
||||
|
||||
animationComponent.position = animationComponent.position - size / 2;
|
||||
add(animationComponent);
|
||||
|
||||
const s = 100.0;
|
||||
final animationComponent2 = SpriteAnimationComponent(s, s, animation);
|
||||
animationComponent2.x = size.x / 2 - s;
|
||||
animationComponent2.y = s;
|
||||
final spriteSize = Vector2.all(100.0);
|
||||
final animationComponent2 = SpriteAnimationComponent(spriteSize, animation);
|
||||
animationComponent2.x = size.x / 2 - spriteSize.x;
|
||||
animationComponent2.y = spriteSize.y;
|
||||
|
||||
final reversedAnimationComponent = SpriteAnimationComponent(
|
||||
s,
|
||||
s,
|
||||
spriteSize,
|
||||
animation.reversed(),
|
||||
);
|
||||
reversedAnimationComponent.x = size.x / 2;
|
||||
reversedAnimationComponent.y = s;
|
||||
reversedAnimationComponent.y = spriteSize.y;
|
||||
|
||||
add(animationComponent2);
|
||||
add(reversedAnimationComponent);
|
||||
|
||||
Reference in New Issue
Block a user