mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 10:38:17 +08:00
* 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>
21 lines
426 B
Dart
21 lines
426 B
Dart
import 'dart:ui';
|
|
|
|
import 'package:flame/components.dart';
|
|
import 'package:flame/palette.dart';
|
|
|
|
class SquareComponent extends PositionComponent {
|
|
Paint paint = BasicPalette.white.paint();
|
|
|
|
SquareComponent({int priority = 0})
|
|
: super(
|
|
size: Vector2.all(100.0),
|
|
priority: priority,
|
|
);
|
|
|
|
@override
|
|
void render(Canvas c) {
|
|
super.render(c);
|
|
c.drawRect(size.toRect(), paint);
|
|
}
|
|
}
|