Skip to content

Instantly share code, notes, and snippets.

@AlabasterAxe
Created November 10, 2020 00:17
Show Gist options
  • Save AlabasterAxe/06ebf5d614a2278159b23741eaeb69a4 to your computer and use it in GitHub Desktop.
Save AlabasterAxe/06ebf5d614a2278159b23741eaeb69a4 to your computer and use it in GitHub Desktop.
Adding the ground to the GameObject rendering loop
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