mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 03:15:43 +08:00
Merge branch 'develop' into v1.0.0
This commit is contained in:
@ -4,7 +4,6 @@ import 'dart:ui';
|
||||
|
||||
import 'package:flame/sprite_animation.dart';
|
||||
import 'package:flame/components/component.dart';
|
||||
import 'package:flame/flare_animation.dart';
|
||||
import 'package:flame/particles/circle_particle.dart';
|
||||
import 'package:flame/particles/composed_particle.dart';
|
||||
import 'package:flame/particles/curved_particle.dart';
|
||||
@ -18,7 +17,6 @@ import 'package:flame/particles/accelerated_particle.dart';
|
||||
import 'package:flame/particles/paint_particle.dart';
|
||||
import 'package:flame/particles/animation_particle.dart';
|
||||
import 'package:flame/particles/component_particle.dart';
|
||||
import 'package:flame/particles/flare_particle.dart';
|
||||
import 'package:flame/flame.dart';
|
||||
import 'package:flame/game.dart';
|
||||
import 'package:flame/time.dart' as flame_time;
|
||||
@ -52,11 +50,9 @@ class MyGame extends BaseGame {
|
||||
|
||||
Offset cellSize;
|
||||
Offset halfCellSize;
|
||||
FlareAnimation flareAnimation;
|
||||
|
||||
MyGame({
|
||||
Size screenSize,
|
||||
this.flareAnimation,
|
||||
}) {
|
||||
size = screenSize;
|
||||
cellSize = Offset(size.width / gridSize, size.height / gridSize);
|
||||
@ -92,7 +88,6 @@ class MyGame extends BaseGame {
|
||||
animationParticle(),
|
||||
fireworkParticle(),
|
||||
componentParticle(),
|
||||
flareParticle(),
|
||||
];
|
||||
|
||||
// Place all the [Particle] instances
|
||||
@ -461,36 +456,6 @@ class MyGame extends BaseGame {
|
||||
);
|
||||
}
|
||||
|
||||
/// [FlareParticle] renders fiven [FlareAnimation] inside
|
||||
/// as you can see, animation could be reused across
|
||||
/// different particles.
|
||||
Particle flareParticle() {
|
||||
final flare = ComposedParticle(children: <Particle>[
|
||||
// Circle Particle for background
|
||||
CircleParticle(
|
||||
paint: Paint()..color = Colors.white12,
|
||||
radius: flareAnimation.width / 2),
|
||||
FlareParticle(flare: flareAnimation),
|
||||
]);
|
||||
|
||||
final List<Offset> corners = [
|
||||
-halfCellSize,
|
||||
halfCellSize,
|
||||
];
|
||||
|
||||
return RotatingParticle(
|
||||
to: pi,
|
||||
child: Particle.generate(
|
||||
count: 2,
|
||||
generator: (i) => MovingParticle(
|
||||
to: corners[i] * .4,
|
||||
curve: SineCurve(),
|
||||
child: flare,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// [Particle] base class exposes a number
|
||||
/// of convenience wrappers to make positioning.
|
||||
///
|
||||
@ -523,6 +488,7 @@ class MyGame extends BaseGame {
|
||||
|
||||
@override
|
||||
bool debugMode() => true;
|
||||
|
||||
@override
|
||||
void render(Canvas canvas) {
|
||||
super.render(canvas);
|
||||
@ -587,13 +553,8 @@ Future<BaseGame> loadGame() async {
|
||||
'boom3.png',
|
||||
]),
|
||||
]);
|
||||
const flareSize = 32.0;
|
||||
final flareAnimation = await FlareAnimation.load('assets/diamond.flr');
|
||||
flareAnimation.updateAnimation('Spin');
|
||||
flareAnimation.width = flareSize;
|
||||
flareAnimation.height = flareSize;
|
||||
|
||||
return MyGame(screenSize: gameSize, flareAnimation: flareAnimation);
|
||||
return MyGame(screenSize: gameSize);
|
||||
}
|
||||
|
||||
/// A curve which maps sinus output (-1..1,0..pi)
|
||||
|
||||
Reference in New Issue
Block a user