mirror of
https://github.com/flame-engine/flame.git
synced 2025-10-30 16:36:57 +08:00
* Add keyboard with focus node implementation * a * format and make it stabel compatible * Add mixin to game * fixes * add tests * format * docs * more docs * Update doc/keyboard-input.md Co-authored-by: Erick <erickzanardoo@gmail.com> * rename test * Apply suggestions from code review Co-authored-by: Luan Nico <luanpotter27@gmail.com> * fix test * Update tutorials/2_sprite_animations_gestures/README.md Co-authored-by: Luan Nico <luanpotter27@gmail.com> * docs * Apply suggestions from code review Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net> * yo Co-authored-by: Erick <erickzanardoo@gmail.com> Co-authored-by: Luan Nico <luanpotter27@gmail.com> Co-authored-by: Jochum van der Ploeg <jochum@vdploeg.net>
41 lines
1.1 KiB
Dart
41 lines
1.1 KiB
Dart
import 'package:flame/components.dart';
|
|
import 'package:flame/extensions.dart';
|
|
import 'package:flame/game.dart';
|
|
import 'package:flame/parallax.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
/// 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
|
|
/// FCS is only used when you extend BaseGame, not Game,
|
|
/// like we do in this example.
|
|
class NoFCSParallaxGame extends Game {
|
|
late Parallax parallax;
|
|
|
|
@override
|
|
Future<void> onLoad() async {
|
|
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);
|
|
}
|
|
}
|