mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-11-01 01:18:38 +08:00 
			
		
		
		
	feat: Adding FlameConsole (#3329)
Adding Flame Console package. --------- Co-authored-by: Lukas Klingsbo <me@lukas.fyi>
This commit is contained in:
		
							
								
								
									
										90
									
								
								packages/flame_console/example/lib/game.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								packages/flame_console/example/lib/game.dart
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,90 @@ | ||||
| import 'dart:async'; | ||||
|  | ||||
| import 'package:flame/collisions.dart'; | ||||
| import 'package:flame/components.dart'; | ||||
| import 'package:flame/effects.dart'; | ||||
| import 'package:flame/events.dart'; | ||||
| import 'package:flame/game.dart'; | ||||
| import 'package:flame/palette.dart'; | ||||
|  | ||||
| class MyGame extends FlameGame with HasKeyboardHandlerComponents { | ||||
|   @override | ||||
|   FutureOr<void> onLoad() async { | ||||
|     await super.onLoad(); | ||||
|  | ||||
|     world.addAll([ | ||||
|       RectangleComponent( | ||||
|         position: Vector2(100, 0), | ||||
|         size: Vector2(100, 100), | ||||
|         paint: BasicPalette.white.paint(), | ||||
|         children: [ | ||||
|           RectangleHitbox.relative( | ||||
|             Vector2.all(0.8), | ||||
|             parentSize: Vector2(100, 100), | ||||
|           ), | ||||
|           SequenceEffect( | ||||
|             [ | ||||
|               MoveEffect.by( | ||||
|                 Vector2(-200, 0), | ||||
|                 LinearEffectController(1), | ||||
|               ), | ||||
|               MoveEffect.by( | ||||
|                 Vector2(200, 0), | ||||
|                 LinearEffectController(1), | ||||
|               ), | ||||
|             ], | ||||
|             infinite: true, | ||||
|           ), | ||||
|         ], | ||||
|       ), | ||||
|       RectangleComponent( | ||||
|         position: Vector2(200, 100), | ||||
|         size: Vector2(100, 100), | ||||
|         paint: BasicPalette.white.paint(), | ||||
|         children: [ | ||||
|           RectangleHitbox.relative( | ||||
|             Vector2.all(0.4), | ||||
|             parentSize: Vector2(100, 100), | ||||
|           ), | ||||
|           SequenceEffect( | ||||
|             [ | ||||
|               MoveEffect.by( | ||||
|                 Vector2(-200, 0), | ||||
|                 LinearEffectController(1), | ||||
|               ), | ||||
|               MoveEffect.by( | ||||
|                 Vector2(200, 0), | ||||
|                 LinearEffectController(1), | ||||
|               ), | ||||
|             ], | ||||
|             infinite: true, | ||||
|           ), | ||||
|         ], | ||||
|       ), | ||||
|       RectangleComponent( | ||||
|         position: Vector2(300, 200), | ||||
|         size: Vector2(100, 100), | ||||
|         paint: BasicPalette.white.paint(), | ||||
|         children: [ | ||||
|           RectangleHitbox.relative( | ||||
|             Vector2.all(0.2), | ||||
|             parentSize: Vector2(100, 100), | ||||
|           ), | ||||
|           SequenceEffect( | ||||
|             [ | ||||
|               MoveEffect.by( | ||||
|                 Vector2(-200, 0), | ||||
|                 LinearEffectController(1), | ||||
|               ), | ||||
|               MoveEffect.by( | ||||
|                 Vector2(200, 0), | ||||
|                 LinearEffectController(1), | ||||
|               ), | ||||
|             ], | ||||
|             infinite: true, | ||||
|           ), | ||||
|         ], | ||||
|       ), | ||||
|     ]); | ||||
|   } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Erick
					Erick