From 1143f3d89cafbf67efd8766f235f4a0846c25183 Mon Sep 17 00:00:00 2001 From: Allison Ryan Date: Thu, 28 Apr 2022 10:57:38 -0500 Subject: [PATCH] chore: fix nits and add todo --- .../lib/src/components/chrome_dino.dart | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/pinball_components/lib/src/components/chrome_dino.dart b/packages/pinball_components/lib/src/components/chrome_dino.dart index 6c419581..e1a1a1fc 100644 --- a/packages/pinball_components/lib/src/components/chrome_dino.dart +++ b/packages/pinball_components/lib/src/components/chrome_dino.dart @@ -12,20 +12,19 @@ import 'package:pinball_components/pinball_components.dart'; /// {@endtemplate} class ChromeDino extends BodyComponent with InitialPosition { /// {@macro chrome_dino} - ChromeDino() : super(priority: RenderPriority.dino) { - renderBody = false; - } + ChromeDino() + : super( + priority: RenderPriority.dino, + renderBody: false, + ); /// The size of the dinosaur mouth. static final size = Vector2(5.5, 5); - static const _framesInAnimation = 98; - - static const _animationFPS = 1 / 24; - /// Anchors the [ChromeDino] to the [RevoluteJoint] that controls its arc /// motion. Future<_ChromeDinoJoint> _anchorToJoint() async { + // TODO(allisonryan0002): try moving to anchor after new body is defined. final anchor = _ChromeDinoAnchor() ..initialPosition = initialPosition + Vector2(9, -4); @@ -45,9 +44,11 @@ class ChromeDino extends BodyComponent with InitialPosition { Future onLoad() async { await super.onLoad(); final joint = await _anchorToJoint(); + const framesInAnimation = 98; + const animationFPS = 1 / 24; await add( TimerComponent( - period: (_framesInAnimation / 2) * _animationFPS, + period: (framesInAnimation / 2) * animationFPS, onTick: joint._swivel, repeat: true, ),