Files
Lukas Klingsbo a882261b63 fix: Deprecate HasGameRef in favor of HasGameReference (#3559)
This deprecates `HasGameRef` and suggests users to use
`HasGameReference` instead.
2025-04-14 18:45:17 +00:00

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();
}
}
}