few fixes

This commit is contained in:
Luan Nico
2017-12-03 12:35:50 -02:00
parent 3c6891a31c
commit fe597efa48
3 changed files with 5 additions and 5 deletions

View File

@ -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;
}
}
}

View File

@ -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());
}
}
}

View File

@ -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);