random pipe position working
This commit is contained in:
parent
4a40175884
commit
8e19fb7cfb
5 changed files with 59 additions and 17 deletions
|
|
@ -1,12 +1,15 @@
|
|||
let obstacle: Obstacle;
|
||||
let raspberry: Raspberry;
|
||||
|
||||
function setup() {
|
||||
createCanvas(400, 400)
|
||||
background(187)
|
||||
line(0,0, 400,400)
|
||||
createCanvas(1000, 1000);
|
||||
|
||||
raspberry = new Raspberry();
|
||||
obstacle = new Obstacle(new Pipe(new Position(width, 0), 20, 50, 0), new Pipe(new Position(width, 300), 20, 50, 0))
|
||||
|
||||
obstacle = new Obstacle(
|
||||
new Pipe(new Position(width, 0), 32, height),
|
||||
new Pipe(new Position(width, height - (height / 3)), 32, height),
|
||||
);
|
||||
}
|
||||
|
||||
function draw() {
|
||||
|
|
@ -15,7 +18,12 @@ function draw() {
|
|||
raspberry.update();
|
||||
obstacle.draw();
|
||||
obstacle.update();
|
||||
|
||||
if (obstacle.position.x < 0) {
|
||||
obstacle.resetPosition();
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// function keyPressed() {
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue