mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-01 19:12:31 +08:00
18 lines
384 B
Dart
18 lines
384 B
Dart
import 'package:flame/components.dart';
|
|
|
|
class StarComponent extends SpriteAnimationComponent with HasGameReference {
|
|
static const speed = 10;
|
|
|
|
StarComponent({super.animation, super.position})
|
|
: super(size: Vector2.all(20));
|
|
|
|
@override
|
|
void update(double dt) {
|
|
super.update(dt);
|
|
y += dt * speed;
|
|
if (y >= game.size.y) {
|
|
removeFromParent();
|
|
}
|
|
}
|
|
}
|