Make gameRef late (#742)

This commit is contained in:
Luan Nico
2021-04-03 19:47:37 -04:00
committed by GitHub
parent 971fc09add
commit bc3820c0fa
12 changed files with 41 additions and 16 deletions

View File

@ -20,14 +20,14 @@ class LogoCompomnent extends SpriteComponent with HasGameRef<DebugGame> {
final rect = toRect();
if ((x <= 0 && xDirection == -1) ||
(rect.right >= gameRef!.size.x && xDirection == 1)) {
(rect.right >= gameRef.size.x && xDirection == 1)) {
xDirection = xDirection * -1;
}
y += yDirection * speed * dt;
if ((y <= 0 && yDirection == -1) ||
(rect.bottom >= gameRef!.size.y && yDirection == 1)) {
(rect.bottom >= gameRef.size.y && yDirection == 1)) {
yDirection = yDirection * -1;
}
}