Files
Renan ccee9a466b Move files to src and comply with the dart package layout convention (#621)
* 👌 Use `Offset` type directly in `JoystickAction.update` calculations (#631)

* Move files to src and comply with the dart package layout convention

* Fixing widgets example

Co-authored-by: Serge Matveenko <lig@countzero.co>
Co-authored-by: Erick Zanardo <erickzanardoo@gmail.com>
2021-01-20 09:05:43 -03:00

36 lines
731 B
Dart

import 'package:flame/components.dart';
import 'package:flame/flame.dart';
import 'package:flame/game.dart';
import 'package:flutter/material.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Flame.util.fullScreen();
runApp(
GameWidget(
game: MyGame(),
),
);
}
class MyGame extends BaseGame {
final _imageNames = [
'bg.png',
'mountain-far.png',
'mountains.png',
'trees.png',
'foreground-trees.png',
];
@override
Future<void> onLoad() async {
final parallax = await ParallaxComponent.load(
_imageNames,
baseVelocity: Vector2(20, 0),
velocityMultiplierDelta: Vector2(1.8, 1.0),
images: images,
);
add(parallax);
}
}