Skip to content

Instantly share code, notes, and snippets.

@AlabasterAxe
Created November 9, 2020 23:46
Show Gist options
  • Save AlabasterAxe/f8b2caba9ca60b427793e35d412065ac to your computer and use it in GitHub Desktop.
Save AlabasterAxe/f8b2caba9ca60b427793e35d412065ac to your computer and use it in GitHub Desktop.
Initial Dino GameObject Implementation for Flutter implementation of Google Chrome Dino Game
Sprite dino = Sprite()
// basically a placeholder because we do the sprite animations separately
..imagePath = "dino/dino_1.png"
..imageWidth = 88
..imageHeight = 94;
class Dino extends GameObject {
@override
Widget render() {
return Image.asset(
dino.imagePath,
gaplessPlayback: true,
);
}
@override
Rect getRect(Size screenSize, double runDistance) {
return Rect.fromLTWH(
screenSize.width / 10,
4 / 7 * screenSize.height - dino.imageHeight,
dino.imageWidth.toDouble(),
dino.imageHeight.toDouble());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment