add more doc

This commit is contained in:
Liu Peng
2020-03-23 22:49:54 +08:00
parent afb4264107
commit ecdadeefe6
5 changed files with 11 additions and 5 deletions

View File

@ -5,6 +5,7 @@
- Check if chidren are loaded before rendering on ComposedComponent (thanks @wenxiangjiang) - Check if chidren are loaded before rendering on ComposedComponent (thanks @wenxiangjiang)
- Amend type for width and height properties on Animation.sequenced (thanks @wenxiangjiang) - Amend type for width and height properties on Animation.sequenced (thanks @wenxiangjiang)
- Fixing Tapable position checking - Fixing Tapable position checking
- Support line feed when create animation from a single image source
## 0.18.1 ## 0.18.1
- Expose stepTime paramter from the Animation class to the animation component - Expose stepTime paramter from the Animation class to the animation component

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

View File

@ -6,6 +6,7 @@ import 'package:flame/components/animation_component.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized();
final Size size = await Flame.util.initialDimensions(); final Size size = await Flame.util.initialDimensions();
final game = MyGame(size); final game = MyGame(size);
runApp(game.widget); runApp(game.widget);
@ -21,10 +22,11 @@ class MyGame extends BaseGame {
textureWidth: 48, textureHeight: 48, stepTime: 0.15); textureWidth: 48, textureHeight: 48, stepTime: 0.15);
void addAnimation() { void addAnimation() {
final animationComponent = final animationComponent = AnimationComponent.sequenced(291, 178, 'creture.png', 18,
AnimationComponent(100, 100, animation, destroyOnFinish: true); amountPerRow: 10, textureWidth: 291, textureHeight: 178, stepTime: 0.15,
animationComponent.x = size.width / 2 - 50; loop: false, destroyOnFinish: true);
animationComponent.y = 200; animationComponent.x = (size.width - 291) / 2;
animationComponent.y = 250;
add(animationComponent); add(animationComponent);
} }

View File

@ -19,3 +19,4 @@ dev_dependencies:
flutter: flutter:
assets: assets:
- assets/images/chopper.png - assets/images/chopper.png
- assets/images/creture.png

View File

@ -55,7 +55,9 @@ class Animation {
/// ///
/// From a single image source, it creates multiple sprites based on the parameters: /// From a single image source, it creates multiple sprites based on the parameters:
/// [amount]: how many sprites this animation is composed of /// [amount]: how many sprites this animation is composed of
/// [amountPerRow]: how many sprites per row /// [amountPerRow]: If the sprites used to create a animation are not on the same row,
/// you can use this parameter to specify how many sprites per row.
/// For detailed, please refer to example at "/doc/examples/animations".
/// [textureX]: x position on the original image to start (defaults to 0) /// [textureX]: x position on the original image to start (defaults to 0)
/// [textureY]: y position on the original image to start (defaults to 0) /// [textureY]: y position on the original image to start (defaults to 0)
/// [textureWidth]: width of each frame (defaults to null, that is, full width of the sprite sheet) /// [textureWidth]: width of each frame (defaults to null, that is, full width of the sprite sheet)