Files
flame/examples/lib/stories/parallax/small_parallax.dart
Lukas Klingsbo 8f7c773f82 Fix parallax size (#800)
* Non-fullscreen ParallaxComponent

* Updated examples with no size needed

* Formatting

* Add docs for fullscreen parallax

* Fix formatting

* Remove need of nullable size

* Add basic parallax sizing test

* Fix formatting

* Remove unused imports

* Info text for the parallax examples
2021-05-20 16:58:49 +02:00

23 lines
576 B
Dart

import 'package:flame/components.dart';
import 'package:flame/game.dart';
class SmallParallaxGame extends BaseGame {
@override
Future<void> onLoad() async {
final component = await loadParallaxComponent(
[
'parallax/bg.png',
'parallax/mountain-far.png',
'parallax/mountains.png',
'parallax/trees.png',
'parallax/foreground-trees.png',
],
size: Vector2.all(200),
baseVelocity: Vector2(20, 0),
velocityMultiplierDelta: Vector2(1.8, 1.0),
)
..position = size / 2;
add(component);
}
}