mirror of
https://github.com/flame-engine/flame.git
synced 2025-10-30 16:36:57 +08:00
* Added Component.childrenFactory * fix some of the lint warnings * more lint warnings * remove changelog entry * more analyzer warnings * one more warning * one more warning * remove more unused imports * fix more warnings * another warning * one more warning * a lot more warnings * some more warnings * fix warnings in flame_svg * fix warnings in flame_bloc * Remove OrderedSet override feature * Remove testRandom change * Remove unnecessary type checks * Re-remove deprecated argument in random_test Co-authored-by: Pasha Stetsenko <stpasha@google.com>
43 lines
1.2 KiB
Dart
43 lines
1.2 KiB
Dart
import 'package:flame/extensions.dart';
|
|
import 'package:flame/game.dart';
|
|
import 'package:flame/parallax.dart';
|
|
|
|
class NoFCSParallaxExample with Loadable, Game {
|
|
static const String description = '''
|
|
This examples serves to test the Parallax feature outside of the Flame
|
|
Component System (FCS), use the other files in this folder for examples on
|
|
how to use parallax with FCS.\n
|
|
FCS is only used when you extend FlameGame, not when you only use the Game
|
|
mixin, like we do in this example.
|
|
''';
|
|
|
|
late Parallax parallax;
|
|
|
|
@override
|
|
Future<void> onLoad() async {
|
|
await super.onLoad();
|
|
parallax = await loadParallax(
|
|
[
|
|
ParallaxImageData('parallax/bg.png'),
|
|
ParallaxImageData('parallax/mountain-far.png'),
|
|
ParallaxImageData('parallax/mountains.png'),
|
|
ParallaxImageData('parallax/trees.png'),
|
|
ParallaxImageData('parallax/foreground-trees.png'),
|
|
],
|
|
size: size,
|
|
baseVelocity: Vector2(20, 0),
|
|
velocityMultiplierDelta: Vector2(1.8, 1.0),
|
|
);
|
|
}
|
|
|
|
@override
|
|
void update(double dt) {
|
|
parallax.update(dt);
|
|
}
|
|
|
|
@override
|
|
void render(Canvas canvas) {
|
|
parallax.render(canvas);
|
|
}
|
|
}
|