mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 11:43:19 +08:00
PR suggestions
This commit is contained in:
committed by
renancaraujo
parent
eba674b898
commit
8d7dd46806
@ -56,7 +56,7 @@ class MyGame extends BaseGame with TapDetector {
|
||||
add(reversedAnimationComponent);
|
||||
}
|
||||
|
||||
void addAnimation(double x, double y) {
|
||||
void addAnimation(Vector2 position) {
|
||||
final size = Vector2(291, 178);
|
||||
|
||||
final animationComponent = SpriteAnimationComponent.fromFrameData(
|
||||
@ -72,14 +72,14 @@ class MyGame extends BaseGame with TapDetector {
|
||||
removeOnFinish: true,
|
||||
);
|
||||
|
||||
animationComponent.position = Vector2(x, y);
|
||||
animationComponent.position = position;
|
||||
animationComponent.position = animationComponent.position - size / 2;
|
||||
add(animationComponent);
|
||||
}
|
||||
|
||||
@override
|
||||
void onTapDown(TapDownDetails evt) {
|
||||
addAnimation(evt.globalPosition.dx, evt.globalPosition.dy);
|
||||
addAnimation(Vector2(evt.globalPosition.dx, evt.globalPosition.dy));
|
||||
}
|
||||
|
||||
MyGame(Vector2 screenSize) {
|
||||
|
||||
Reference in New Issue
Block a user