From fe597efa4807f19b2cd40167aa8cd2ec8fcbe5b9 Mon Sep 17 00:00:00 2001 From: Luan Nico Date: Sun, 3 Dec 2017 12:35:50 -0200 Subject: [PATCH] few fixes --- lib/components/animation_component.dart | 3 +-- lib/game.dart | 3 ++- lib/sprite.dart | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/components/animation_component.dart b/lib/components/animation_component.dart index 9958659cd..569eb1f91 100644 --- a/lib/components/animation_component.dart +++ b/lib/components/animation_component.dart @@ -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; } -} \ No newline at end of file +} diff --git a/lib/game.dart b/lib/game.dart index 210a6343c..25adc30c7 100644 --- a/lib/game.dart +++ b/lib/game.dart @@ -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()); } -} \ No newline at end of file +} diff --git a/lib/sprite.dart b/lib/sprite.dart index b904056d7..9a2046e43 100644 --- a/lib/sprite.dart +++ b/lib/sprite.dart @@ -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);