From 2fc6d91fca5a9fcf11492ab0ff85dac2075eaeb8 Mon Sep 17 00:00:00 2001
From: roguecomp <roguecomp001@gmail.com>
Date: Fri, 10 Sep 2021 10:56:16 +1000
Subject: [PATCH] Added Pipe class and spawn logic

---
 src/Pipe.java | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)
 create mode 100644 src/Pipe.java

diff --git a/src/Pipe.java b/src/Pipe.java
new file mode 100644
index 0000000..3ebc9f0
--- /dev/null
+++ b/src/Pipe.java
@@ -0,0 +1,28 @@
+import bagel.*;
+
+public class Pipe {
+    private final double velocity = -5;
+    private double pos = Window.getWidth(); /* x-coord at spawn */
+    private final int pixelGap = 168;
+
+    /* the higher this value the higher the pipe gap spawns, vice versa */
+    private final int initialY = 50; /* y-value of pipe at spawn */
+
+    private Image pipeImage = new Image("res/pipe.png");
+
+    public void Pipe() {
+
+    }
+
+    public void Render() {
+        /* upside down pipe */
+        this.pipeImage.draw(this.pos, -this.initialY);
+
+        /* straight up pipe */
+        DrawOptions options = new DrawOptions();
+        this.pipeImage.draw(this.pos, Window.getHeight() -this.initialY +this.pixelGap,
+                options.setRotation(Math.PI));
+
+        this.pos += this.velocity;
+    }
+}
\ No newline at end of file
-- 
GitLab