Skip to content

Instantly share code, notes, and snippets.

@AlabasterAxe
Created November 10, 2020 00:18
Show Gist options
  • Save AlabasterAxe/5e65927ee750a8bf5b43db46e1247fda to your computer and use it in GitHub Desktop.
Save AlabasterAxe/5e65927ee750a8bf5b43db46e1247fda to your computer and use it in GitHub Desktop.
Adding Parallax to the clouds for the Flutter Dino game.
@override
Rect getRect(Size screenSize, double runDistance) {
return Rect.fromLTWH(
(location.dx - runDistance) WORLD_TO_PIXEL_RATIO / 5,
2 / 7 screenSize.height - cloud.imageHeight - location.dy,
cloud.imageWidth.toDouble(),
cloud.imageHeight.toDouble());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment