mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-11-04 04:47:13 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			23 lines
		
	
	
		
			528 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			528 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
import 'package:flame/components.dart';
 | 
						|
import 'package:flame/game.dart';
 | 
						|
 | 
						|
class BasicParallaxGame extends BaseGame {
 | 
						|
  final _imageNames = [
 | 
						|
    'parallax/bg.png',
 | 
						|
    'parallax/mountain-far.png',
 | 
						|
    'parallax/mountains.png',
 | 
						|
    'parallax/trees.png',
 | 
						|
    'parallax/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);
 | 
						|
  }
 | 
						|
}
 |