mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-04 04:47:13 +08:00
Update game.md (#1127)
* Update game.md fixed the load error for the readme docs. * Update game.md * Update doc/game.md Co-authored-by: Lukas Klingsbo <lukas.klingsbo@gmail.com>
This commit is contained in:
@ -28,14 +28,17 @@ class MyCrate extends SpriteComponent {
|
||||
|
||||
@override
|
||||
void onGameResize(Vector2 gameSize) {
|
||||
// We don't need to set the position in the constructor, we can it directly here since it will
|
||||
super.onGameResize(gameSize);
|
||||
// We don't need to set the position in the constructor, we can set it directly here since it will
|
||||
// be called once before the first time it is rendered.
|
||||
position = gameSize / 2;
|
||||
}
|
||||
}
|
||||
|
||||
class MyGame extends FlameGame {
|
||||
MyGame() {
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
await super.onLoad();
|
||||
add(MyCrate());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user