feat: Children as argument to FlameGame (#1680)

Since we have already added children as an argument to Component, this adds it to the FlameGame.
This commit is contained in:
Lukas Klingsbo
2022-06-01 22:58:59 +02:00
committed by GitHub
parent 801dbba1d8
commit db336c03b6
5 changed files with 122 additions and 41 deletions

View File

@ -9,16 +9,15 @@ class PriorityExample extends FlameGame with HasTappables {
the priority.
''';
@override
Future<void> onLoad() async {
final squares = [
Square(Vector2(100, 100)),
Square(Vector2(160, 100)),
Square(Vector2(170, 150)),
Square(Vector2(110, 150)),
];
addAll(squares);
}
PriorityExample()
: super(
children: [
Square(Vector2(100, 100)),
Square(Vector2(160, 100)),
Square(Vector2(170, 150)),
Square(Vector2(110, 150)),
],
);
}
class Square extends RectangleComponent