mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-10-31 17:06:50 +08:00 
			
		
		
		
	 b3efb612cb
			
		
	
	b3efb612cb
	
	
	
		
			
			Adds a new key api on FCS, which will allow users to get a component from the tree, without needing to iterate over all the children or a parent descendants.
		
			
				
	
	
		
			26 lines
		
	
	
		
			650 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
			
		
		
	
	
			26 lines
		
	
	
		
			650 B
		
	
	
	
		
			Dart
		
	
	
	
	
	
| import 'package:flame/components.dart';
 | |
| import 'package:flame/game.dart';
 | |
| import 'package:meta/meta.dart';
 | |
| 
 | |
| class Ember<T extends FlameGame> extends SpriteAnimationComponent
 | |
|     with HasGameRef<T> {
 | |
|   Ember({super.position, Vector2? size, super.priority, super.key})
 | |
|       : super(
 | |
|           size: size ?? Vector2.all(50),
 | |
|           anchor: Anchor.center,
 | |
|         );
 | |
| 
 | |
|   @mustCallSuper
 | |
|   @override
 | |
|   Future<void> onLoad() async {
 | |
|     animation = await gameRef.loadSpriteAnimation(
 | |
|       'animations/ember.png',
 | |
|       SpriteAnimationData.sequenced(
 | |
|         amount: 3,
 | |
|         textureSize: Vector2.all(16),
 | |
|         stepTime: 0.15,
 | |
|       ),
 | |
|     );
 | |
|   }
 | |
| }
 |