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

View File

@ -69,6 +69,7 @@ class BaseGame extends Game {
canvas.restore();
canvas.save();
});
canvas.restore();
}
@override

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