mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 19:12:31 +08:00
PR suggestions
This commit is contained in:
@ -90,6 +90,10 @@ This component wraps an instance of the [FlareAnimation](/doc/images.md#FlareAni
|
|||||||
add(flareAnimation);
|
add(flareAnimation);
|
||||||
```
|
```
|
||||||
|
|
||||||
|
You can also change the current playing animation using the `updateAnimation` method.
|
||||||
|
|
||||||
|
For a working example, check this [source file](/doc/examples/flare/lib/main_component.dart).
|
||||||
|
|
||||||
## Composed component
|
## Composed component
|
||||||
|
|
||||||
A mixin that helps you to make a `Component` wraps other components. It is useful to group visual components through a hierarchy. When implemented, makes every item in its `components` collection field be updated and rendered with the same conditions.
|
A mixin that helps you to make a `Component` wraps other components. It is useful to group visual components through a hierarchy. When implemented, makes every item in its `components` collection field be updated and rendered with the same conditions.
|
||||||
@ -199,4 +203,4 @@ The corners are drawn at the same size, the sides are streched on the side direc
|
|||||||
|
|
||||||
Using this, you can get a box/rectangle that expands well to any sizes. This is useful for making panels, dialogs, borders.
|
Using this, you can get a box/rectangle that expands well to any sizes. This is useful for making panels, dialogs, borders.
|
||||||
|
|
||||||
Check the example app `nine_tile_box` details on how to use it.
|
Check the example app `nine_tile_box` details on how to use it.
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
import 'package:flame/gestures.dart';
|
import 'package:flame/gestures.dart';
|
||||||
import 'package:flame/flame.dart';
|
|
||||||
import 'package:flame/game.dart';
|
import 'package:flame/game.dart';
|
||||||
import 'package:flame/components/flare_component.dart';
|
import 'package:flame/components/flare_component.dart';
|
||||||
import 'package:flame/text_config.dart';
|
import 'package:flame/text_config.dart';
|
||||||
import 'package:flame/position.dart';
|
import 'package:flame/position.dart';
|
||||||
|
import 'package:flame/palette.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
@ -16,11 +16,10 @@ void main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MyGame extends BaseGame with TapDetector, DoubleTapDetector {
|
class MyGame extends BaseGame with TapDetector, DoubleTapDetector {
|
||||||
final TextConfig fpsTextConfig =
|
final TextConfig fpsTextConfig = TextConfig(color: BasicPalette.white.color);
|
||||||
const TextConfig(color: const Color(0xFFFFFFFF));
|
|
||||||
|
|
||||||
final paint = Paint()..color = const Color(0xFFE5E5E5E5);
|
final paint = Paint()..color = const Color(0xFFE5E5E5E5);
|
||||||
final List<String> _animations = ["Stand", "Wave", "Jump", "Dance"];
|
final List<String> _animations = ['Stand', 'Wave', 'Jump', 'Dance'];
|
||||||
int _currentAnimation = 0;
|
int _currentAnimation = 0;
|
||||||
FlareComponent flareComponent;
|
FlareComponent flareComponent;
|
||||||
|
|
||||||
@ -57,7 +56,7 @@ class MyGame extends BaseGame with TapDetector, DoubleTapDetector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _start() async {
|
void _start() async {
|
||||||
flareComponent = FlareComponent("assets/Bob_Minion.flr", "Stand", 306, 228);
|
flareComponent = FlareComponent('assets/Bob_Minion.flr', 'Stand', 306, 228);
|
||||||
flareComponent.x = 50;
|
flareComponent.x = 50;
|
||||||
flareComponent.y = 240;
|
flareComponent.y = 240;
|
||||||
add(flareComponent);
|
add(flareComponent);
|
||||||
|
|||||||
Reference in New Issue
Block a user