Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 851 Bytes

useful_components.md

File metadata and controls

44 lines (32 loc) · 851 Bytes

Useful

ValueGeneratorComponent

Useful for generating animations.

   gameRef.getValueGenerator(
      Duration(seconds: 1),
      begin: 0.0,
      end: 1.0,
      onChange: (value) {

      },
      onFinish: () {

      },
      curve: Curves.decelerate,
   ).start();

FollowerWidget

You can show a widget to follow a component in the game. This is useful to create dialogs, inventory, interactions, etc.

To show is easy, just call FollowerWidget.show. See below:

   FollowerWidget.show(
      identify: 'PLAYER_INVENTORY', // identify used to remove
      context: context,
      target: player, // You can add here any GameComponent
      child: MyWidget(), // Add here your widget
      align: Offset.zero, // Align from targe
   );

To hide:

   FollowerWidget.remove('PLAYER_INVENTORY');