Possibility to change priority and reorder the component list (#793)

* Possibility to change component priority

* Fix formatting

* Posibility to change priority

* Docs for priority change

* Priority example

* Add section explaining priority

* Update doc/game.md

Co-authored-by: Erick <erickzanardoo@gmail.com>

* Update examples/lib/stories/components/components.dart

Co-authored-by: Erick <erickzanardoo@gmail.com>

* No null priorities in the super call chain

* Possibility to wait for all children to be loaded

* Test for addChildren

* Introduce parent to Component

* Check whether parent is BaseComponent

Co-authored-by: Erick <erickzanardoo@gmail.com>
This commit is contained in:
Lukas Klingsbo
2021-05-19 19:07:54 +02:00
committed by GitHub
parent 5f78a15770
commit ef7427941c
13 changed files with 301 additions and 25 deletions

View File

@ -6,7 +6,11 @@ import 'package:flame/palette.dart';
class SquareComponent extends PositionComponent {
Paint paint = BasicPalette.white.paint();
SquareComponent() : super(size: Vector2.all(100.0));
SquareComponent({int priority = 0})
: super(
size: Vector2.all(100.0),
priority: priority,
);
@override
void render(Canvas c) {