Used to create cutscenes.
To create a scene just call gameRef.startScene
:
final enemy = gameRef.visibleEnemies().first;
gameRef.startScene(
[
CameraSceneAction.position(Vector2(800, 800)),
CameraSceneAction.target(gameRef.player!),
CameraSceneAction.target(enemy, zoom: 2),
DelaySceneAction(Duration(seconds: 1)),
MoveComponentSceneAction(
component: enemy,
newPosition: enemy.position.clone()..add(Vector2(-40, -10)),
speed: 20,
),
CameraSceneAction.target(gameRef.player!, zoom: 1),
],
);
Result:
- To stop current scene:
gameRef.stopScene();
- To access status and current
SeceneAction
:
SceneBuilderStatus status = gameRef.sceneBuilderStatus;
status.isRuning;
status.currentAction;
Already exist basic actions created:
- CameraSceneAction // Used to move camera to position or to follow a target.
- DelaySceneAction // Used to apply delay
- MoveComponentSceneAction // Used to move any component that use
Movement
mixin - AwaitCallbackSceneAction // Used to do anything and when completed just call the function
completed
that will pass to next action.