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);
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
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.
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import 'dart:ui';
|
||||
import 'package:flame/gestures.dart';
|
||||
import 'package:flame/flame.dart';
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:flame/components/flare_component.dart';
|
||||
import 'package:flame/text_config.dart';
|
||||
import 'package:flame/position.dart';
|
||||
import 'package:flame/palette.dart';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -16,11 +16,10 @@ void main() {
|
||||
}
|
||||
|
||||
class MyGame extends BaseGame with TapDetector, DoubleTapDetector {
|
||||
final TextConfig fpsTextConfig =
|
||||
const TextConfig(color: const Color(0xFFFFFFFF));
|
||||
final TextConfig fpsTextConfig = TextConfig(color: BasicPalette.white.color);
|
||||
|
||||
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;
|
||||
FlareComponent flareComponent;
|
||||
|
||||
@ -57,7 +56,7 @@ class MyGame extends BaseGame with TapDetector, DoubleTapDetector {
|
||||
}
|
||||
|
||||
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.y = 240;
|
||||
add(flareComponent);
|
||||
|
||||
Reference in New Issue
Block a user