Skip to content
Snippets Groups Projects
Commit 2fc6d91f authored by roguecomp's avatar roguecomp
Browse files

Added Pipe class and spawn logic

parent 3b6522d9
No related branches found
No related tags found
No related merge requests found
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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment