refactor: removed late SpriteComponent

pull/158/head
alestiago 4 years ago
parent 2ec521451d
commit 97f574800d

@ -30,16 +30,14 @@ class Ball<T extends Forge2DGame> extends BodyComponent<T>
double _boostTimer = 0; double _boostTimer = 0;
static const _boostDuration = 2.0; static const _boostDuration = 2.0;
late SpriteComponent _spriteComponent;
final SpriteComponent _spriteComponent = _BallSprite();
@override @override
Future<void> onLoad() async { Future<void> onLoad() async {
await super.onLoad(); await super.onLoad();
await add( await add(
_BallSprite() _spriteComponent..tint(baseColor.withOpacity(0.5)),
..tint(
baseColor.withOpacity(0.5),
),
); );
} }
@ -114,7 +112,6 @@ class _BallSprite extends SpriteComponent with HasGameRef {
@override @override
Future<void> onLoad() async { Future<void> onLoad() async {
await super.onLoad(); await super.onLoad();
final sprite = await gameRef.loadSprite( final sprite = await gameRef.loadSprite(
Assets.images.ball.keyName, Assets.images.ball.keyName,
); );

Loading…
Cancel
Save