mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 11:43:19 +08:00
few fixes
This commit is contained in:
@ -14,7 +14,6 @@ class AnimationComponent extends PositionComponent {
|
||||
AnimationComponent.spriteList(this.width, this.height, this.sprites, { this.stepTime, this.lifeTime });
|
||||
|
||||
AnimationComponent.sequenced(this.width, this.height, String imagePath, int amount, { double textureX = 0.0, double textureY = 0.0, double textureWidth = -1.0, double textureHeight = -1.0}) {
|
||||
angle = 0.0;
|
||||
if (textureWidth == -1) {
|
||||
textureWidth = this.width;
|
||||
}
|
||||
@ -39,4 +38,4 @@ class AnimationComponent extends PositionComponent {
|
||||
void update(double t) {
|
||||
this.lifeTime += t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,6 +69,7 @@ class BaseGame extends Game {
|
||||
canvas.restore();
|
||||
canvas.save();
|
||||
});
|
||||
canvas.restore();
|
||||
}
|
||||
|
||||
@override
|
||||
@ -76,4 +77,4 @@ class BaseGame extends Game {
|
||||
components.forEach((c) => c.update(t));
|
||||
components.removeWhere((c) => c.destroy());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,10 +12,10 @@ class Sprite {
|
||||
Sprite(String fileName, {double x = 0.0, double y = 0.0, double width = -1.0, double height = -1.0}) {
|
||||
Flame.images.load(fileName).then((img) {
|
||||
if (width == -1.0) {
|
||||
width = img.width as double;
|
||||
width = img.width.toDouble();
|
||||
}
|
||||
if (height == -1.0) {
|
||||
width = img.height as double;
|
||||
height = img.height.toDouble();
|
||||
}
|
||||
this.image = img;
|
||||
this.src = new Rect.fromLTWH(x, y, width, height);
|
||||
|
||||
Reference in New Issue
Block a user