diff --git a/lib/components/animation_component.dart b/lib/components/animation_component.dart index 4b0327b79..d8197a124 100644 --- a/lib/components/animation_component.dart +++ b/lib/components/animation_component.dart @@ -6,6 +6,8 @@ import 'package:flame/animation.dart'; class AnimationComponent extends PositionComponent { Animation animation; + AnimationComponent(); + AnimationComponent(double width, double height, this.animation) { this.width = width; this.height = height; diff --git a/lib/sprite.dart b/lib/sprite.dart index a8f6a60a4..d29296e7e 100644 --- a/lib/sprite.dart +++ b/lib/sprite.dart @@ -77,11 +77,15 @@ class Sprite { return new Position(_imageWidth, _imageHeight); } + Position get size { + return new Position(src.width, src.height); + } + void renderPosition(Canvas canvas, Position p, [Position size]) { if (!this.loaded()) { return; } - size ??= originalSize; + size ??= this.size; renderRect(canvas, Position.rectFrom(p, size)); } @@ -89,8 +93,8 @@ class Sprite { if (!this.loaded()) { return; } - width ??= _imageWidth; - height ??= _imageHeight; + width ??= this.size.x; + height ??= this.size.y; renderRect(canvas, new Rect.fromLTWH(0.0, 0.0, width, height)); }