mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-13 11:20:19 +08:00
Null-safety (#685)
This commit is contained in:
@@ -21,7 +21,7 @@ void main() async {
|
||||
|
||||
class MyCollidable extends PositionComponent
|
||||
with HasGameRef<MyGame>, Hitbox, Collidable {
|
||||
Vector2 velocity;
|
||||
late Vector2 velocity;
|
||||
final _collisionColor = Colors.amber;
|
||||
bool _isWallHit = false;
|
||||
bool _isCollision = false;
|
||||
@@ -35,7 +35,7 @@ class MyCollidable extends PositionComponent
|
||||
|
||||
@override
|
||||
Future<void> onLoad() async {
|
||||
final center = gameRef.size / 2;
|
||||
final center = gameRef!.size / 2;
|
||||
velocity = (center - position).normalized() * 150;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user