Flame extension for displaying progress bar during game's onLoad process and also for rendering transition animation between widget and game
Features
- Display loading screen with progress bar
- Use any Flutter widget for this purpose without special requirements
- Render transition animation between game ans loading screen after
onLoadis finished
Getting started
Steps you should to perform to make things work:
- Define messaging class to represent progress message from game to widget. Or ypu can use a simple
type like
Stringorint - Add mixins to your Flame game's class:
HasMessageProvidersandHasLoadingProgresswith specifying message class type chosen in step 1 - Insert calls of
reportLoadingProgressfunction intoonLoadfunction of the game. - Create subclass of
LoadingWidgetBuilderand implement methodsbuildOnMessageandbuildTransitionToGame. In the last method usegameWidgetparameter to render original Flame'sGameWidgetin widget's tree. You can use any existing Flutter widget for progress reporting, or create your own, or even use one from third-party libraries. Unleash your creativity here! - Use
GameWidgetWrapperclass instead originalGameWidget. Specify your new class from step 4 intoloadingWidgetBuilderparameter. - Enjoy pretty animations!
Usage
For more detailed instructions check the game.dart file, where steps 1-4 are illustrated. Check main.dart for step 5.
Also visit live demo to see this package in action.
Libraries
- flame_loading_progress
- The library provides extended API (compare to Flame's "loadBuilder"), which allows to display progress bar while game loading, and to create transition animation from loading screen to the game.