Created
November 10, 2020 00:17
-
-
Save AlabasterAxe/06ebf5d614a2278159b23741eaeb69a4 to your computer and use it in GitHub Desktop.
Adding the ground to the GameObject rendering loop
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
for (GameObject object in [...ground, ...obstacles, dino]) { | |
children.add( | |
AnimatedBuilder( | |
animation: worldController, | |
builder: (context, child) { | |
Rect objectRect = object.getRect(screenSize, runDistance); | |
return Positioned( | |
top: objectRect.top, | |
left: objectRect.left, | |
width: objectRect.width, | |
height: objectRect.height, | |
child: object.render()); | |
}), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment