From 3b6522d92d8b6bfe7f71ec7cd044766691e6415b Mon Sep 17 00:00:00 2001 From: roguecomp <roguecomp001@gmail.com> Date: Fri, 10 Sep 2021 03:57:32 +1000 Subject: [PATCH] added Bird.class with its own attributes --- src/Bird.java | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/Bird.java diff --git a/src/Bird.java b/src/Bird.java new file mode 100644 index 0000000..c4d1967 --- /dev/null +++ b/src/Bird.java @@ -0,0 +1,30 @@ +import bagel.Image; + +public class Bird { + /* positive means moving up, negative means moving down */ + public double velocity; + private static int frameCounterSinceStart = 0; + + public Image birdWingUp = new Image("res/birdWingUp.png"); + public Image birdWingDown = new Image("res/birdWingDown.png"); + + public final double acceleration = 0.4; + public final double terminalVelocity = 10; + + public final double x = 200; + public double y = 350; + + public void Bird() { + } + + public void Render() { + + if(this.frameCounterSinceStart % 10 == 0) { + this.birdWingUp.draw(this.x, this.y); /* repeat every 10 frames */ + } + else { + this.birdWingDown.draw(this.x, this.y); + } + this.frameCounterSinceStart++; + } +} \ No newline at end of file -- GitLab