Files
Erick d98a1ede44 Improving Parallax APIs regarding handling its size and the use outside FCS (#651)
* Improving Parallax APIs regarding handling its size and the use outside FCS

* Formatting

* Fixing flutter format vs flutter analyze crazy conflicts

* Some suggestions

* Removing unecessary line

* Luan suggestions

* Luan suggestion

* Lukas suggestions

* updating comment
2021-02-04 12:26:37 -03:00

35 lines
710 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.device.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 loadParallaxComponent(
_imageNames,
baseVelocity: Vector2(20, 0),
velocityMultiplierDelta: Vector2(1.8, 1.0),
);
add(parallax);
}
}