2021-10-09 03:59:38 +00:00
|
|
|
import 'package:firo_runner/moving_objects/moving_object.dart';
|
2021-09-04 04:17:12 +00:00
|
|
|
import 'package:firo_runner/main.dart';
|
|
|
|
import 'package:flame/components.dart';
|
|
|
|
|
|
|
|
enum CoinState { normal }
|
|
|
|
|
|
|
|
class Coin extends MovingObject {
|
|
|
|
Coin(MyGame gameRef) : super(gameRef) {
|
2021-10-05 23:19:58 +00:00
|
|
|
List<Sprite> coin = gameRef.coinHolder.getCoin();
|
|
|
|
SpriteAnimation normal = SpriteAnimation.spriteList(coin, stepTime: 0.1);
|
2021-09-04 04:17:12 +00:00
|
|
|
|
|
|
|
sprite = SpriteAnimationGroupComponent(
|
|
|
|
animations: {
|
|
|
|
CoinState.normal: normal,
|
|
|
|
},
|
|
|
|
current: CoinState.normal,
|
|
|
|
);
|
|
|
|
|
2021-09-04 22:56:08 +00:00
|
|
|
sprite.changePriorityWithoutResorting(COIN_PRIORITY);
|
|
|
|
|
2021-10-05 23:19:58 +00:00
|
|
|
var platform = gameRef.platformHolder.l1[0].image;
|
2021-09-04 04:17:12 +00:00
|
|
|
|
|
|
|
setSize(
|
2021-10-05 23:19:58 +00:00
|
|
|
gameRef.blockSize * (platform.width / platform.height / 2.8),
|
|
|
|
gameRef.blockSize * (platform.width / platform.height / 2.8),
|
2021-09-04 04:17:12 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|