Created
November 9, 2020 23:46
-
-
Save AlabasterAxe/f8b2caba9ca60b427793e35d412065ac to your computer and use it in GitHub Desktop.
Initial Dino GameObject Implementation for Flutter implementation of Google Chrome 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
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