refactor: moved renderBody to onLoad

pull/72/head
alestiago 4 years ago
parent f3e0594eba
commit 44b9b161be

@ -26,9 +26,7 @@ class Flipper extends BodyComponent with KeyboardHandler, InitialPosition {
/// {@macro flipper} /// {@macro flipper}
Flipper({ Flipper({
required this.side, required this.side,
}) : _keys = side.isLeft ? _leftFlipperKeys : _rightFlipperKeys { }) : _keys = side.isLeft ? _leftFlipperKeys : _rightFlipperKeys;
renderBody = false;
}
/// The size of the [Flipper]. /// The size of the [Flipper].
static final size = Vector2(12, 2.8); static final size = Vector2(12, 2.8);
@ -142,6 +140,8 @@ class Flipper extends BodyComponent with KeyboardHandler, InitialPosition {
@override @override
Future<void> onLoad() async { Future<void> onLoad() async {
await super.onLoad(); await super.onLoad();
renderBody = false;
await Future.wait([ await Future.wait([
_loadSprite(), _loadSprite(),
_anchorToJoint(), _anchorToJoint(),

Loading…
Cancel
Save