Files
Lukas Klingsbo 9c1e1c3098 chore: Remove deprecations for v1.9.0 (#2749)
Removes everything that was marked as deprecated and that should be
removed for v1.9.0.
2023-09-19 16:47:41 +02:00

29 lines
645 B
Dart

import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart';
class MyGameWidget extends StatelessWidget {
const MyGameWidget({super.key});
@override
Widget build(BuildContext context) {
return GameWidget(game: MyGame());
}
}
class Background extends SpriteComponent with HasGameReference<MyGame> {
@override
Future<void> onLoad() async {
sprite = await game.loadSprite('city.png');
size = Vector2.all(200);
position = Vector2.all(100);
}
}
class MyGame extends FlameGame {
@override
Future<void> onLoad() async {
await world.add(Background());
}
}