Created
November 10, 2020 00:18
-
-
Save AlabasterAxe/5e65927ee750a8bf5b43db46e1247fda to your computer and use it in GitHub Desktop.
Adding Parallax to the clouds for the Flutter Dino game.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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