You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pinball/lib/game/components/initial_position.dart

18 lines
463 B

import 'package:flame_forge2d/flame_forge2d.dart';
/// Forces a given [BodyComponent] to position their [body] to an
/// [initialPosition].
mixin InitialPosition<T extends Forge2DGame> on BodyComponent<T> {
/// The initial position of the [body].
late final Vector2 initialPosition;
@override
void onMount() {
super.onMount();
assert(
body.position == initialPosition,
'Body position is not equal to initial position.',
);
}
}