Your browser does not support the canvas tag.

previous        Show / Hide Source        Download        next
/* High Stakes - Two Player Hot Air Balloon Game
 Emerson Simmonds
 Pilot the ballons with the arrow keys for Player 1 and WASD for Player 2
 Try and pop enemy balloons with your spikes and capture their passengers
 Avoid the airplanes and the trees
 You have 3 lives
 */

//Variable Initialization for player 1
float balloonX = 350;
float balloonY = 260;
float balloonLift = 2;
float balloonSpeed = 2;
float balloonGravity = 0.8;

//Variable Initialization for player 2
float balloonTwoX = 50;
float balloonTwoY = 260;
float balloonTwoLift = 2;
float balloonTwoSpeed = 2;
float balloonTwoGravity = 0.8;

int lives = 3;
int p2Lives = 3;
int score = 0;
int p2Score = 0;
float passenger1X;
float passenger1Y;
boolean passenger1Falling;
float passenger2X;
float passenger2Y;
boolean passenger2Falling;
float passenger3X;
float passenger3Y;
boolean passenger3Falling;

boolean up;   //Keypresses
boolean leftKey; 
boolean rightKey;
boolean p2Up;
boolean pTwoLeftKey;  
boolean pTwoRightKey;
boolean enter;
boolean cloudNumbers = false; //Makes the random cloud numbers generate only once
boolean enemyBalloonDefeat = false; //When the player 1 balloon is popped
boolean enemyBalloonDefeatP2 = false; //Player two balloon popped
boolean gameOver = false; //For game over screen
boolean startGame = false; //For start menu

//Had to declare random cloud variables outside the function 
//so they could be outside the if statement without being called repeatedly 
float cloud1X;
float cloud1Y;
float cloud1SizeX;
float cloud1SizeY;
float cloud1Speed;

float cloud2X;
float cloud2Y;
float cloud2SizeX;
float cloud2SizeY;
float cloud2Speed;

float cloud3X;
float cloud3Y;
float cloud3SizeX;
float cloud3SizeY;
float cloud3Speed;

float cloud4X;
float cloud4Y;
float cloud4SizeX;
float cloud4SizeY;
float cloud4Speed;

float cloud5X;
float cloud5Y;
float cloud5SizeX;
float cloud5SizeY;
float cloud5Speed;

float cloud6X;
float cloud6Y;
float cloud6SizeX;
float cloud6SizeY;
float cloud6Speed;

float cloud7X;
float cloud7Y;
float cloud7SizeX;
float cloud7SizeY;
float cloud7Speed;

float cloud8X;
float cloud8Y;
float cloud8SizeX;
float cloud8SizeY;
float cloud8Speed;

float cloud9X;
float cloud9Y;
float cloud9SizeX;
float cloud9SizeY;
float cloud9Speed;

float cloud10X;
float cloud10Y;
float cloud10SizeX;
float cloud10SizeY;
float cloud10Speed;

float airplane1;
float airplane2;
boolean airplaneRandom = false;

void setup() {

  //Initializes size and eliminates cursor
  size(400, 400);
  noCursor();
}

void draw() {


  //checks to see if the game has ended to keep running game
  if (gameOver == false && startGame == true) {

    //Draws the background before anything else
    drawBackground();

    //Functional Stuff
    collision();
    passengers();
    playerDeath();
    buttonInput();

    //Drawing all the sections
    drawTrees();
    drawUI();
    drawPlayers();
    drawClouds();
    //Runs the game over menu
  } else if (startGame == true) { 

    background(100, 149, 237);
    rectMode(CENTER);
    textSize(34);
    text("Game Over", 100, 100);
    text("P1 Score: ", 90, 200);
    text(score, 260, 200);
    text("P2 Score: ", 90, 240);
    text(p2Score, 260, 240);
  }

  //Start game menu
  if (startGame == false) {

    background(100, 149, 237);
    rectMode(CENTER);
    textSize(34);
    text("High Stakes", 100, 150);
    text("Press Enter to Start", 40, 200);
    text("P1", 80, 260);
    text("P2", 280, 260);
    fill(255);
    noStroke();
    rect(40, 360, 40, 40, 4);
    rect(100, 360, 40, 40, 4);
    rect(160, 360, 40, 40, 4);
    rect(100, 300, 40, 40, 4);

    rect(360, 360, 40, 40, 4);
    rect(300, 360, 40, 40, 4);
    rect(240, 360, 40, 40, 4);
    rect(300, 300, 40, 40, 4);

    fill(0);
    textSize(15);
    text("A", 30, 360);
    text("D", 150, 360);
    text("W", 90, 300);

    textSize(10);
    text("LEFT", 350, 360);
    text("RIGHT", 225, 360);
    text("UP", 290, 300);

    if (enter == true) {
      startGame = true;
    }
  }
}

void passengers() {

  //If player 2 pops player 1
  if (enemyBalloonDefeat == true) {

    passenger1X = balloonX;
    passenger1Y = balloonY + 10;


    passenger1Falling = true;
  }

  //Player one picks up 
  if (passenger1X > balloonX - 10 && passenger1X < balloonX + 10 && passenger1Y > balloonY -10 && passenger1Y < balloonY +10 && passenger1Falling == true) {
    score = score + 1;
    passenger1Falling = false;
  }
  //Player two picks up
  if (passenger1X > balloonTwoX - 10 && passenger1X < balloonTwoX + 10 && passenger1Y > balloonTwoY - 10 && passenger1Y < balloonTwoY + 10 && passenger1Falling == true) {
    p2Score = p2Score + 1;
    passenger1Falling = false;
  }

  //Passenger falls until picked up or dead
  if (passenger1Falling == true) {

    passenger1Y += 0.5;
    fill(0);
    ellipse(passenger1X, passenger1Y, 5, 5);
    strokeWeight(2);
    stroke(0);
    line(passenger1X, passenger1Y, passenger1X, passenger1Y + 5);
  } else if (passenger1Y > 400) {
    passenger1Falling = false;
  }


  //If player 1 pops player 2
  if (enemyBalloonDefeatP2 == true) {

    passenger2X = balloonTwoX;
    passenger2Y = balloonTwoY + 10;


    passenger2Falling = true;
  }

  //Player one picks up 
  if (passenger2X > balloonX - 10 && passenger2X < balloonX + 10 && passenger2Y > balloonY -10 && passenger2Y < balloonY +10 && passenger2Falling == true) {
    score = score + 1;
    passenger2Falling = false;
  }
  //Player two picks up
  if (passenger2X > balloonTwoX - 10 && passenger2X < balloonTwoX + 10 && passenger2Y > balloonTwoY - 10 && passenger2Y < balloonTwoY + 10 && passenger2Falling == true) {
    p2Score = p2Score + 1;
    passenger2Falling = false;
  }

  //Passenger falls until picked up or dead
  if (passenger2Falling == true) {

    passenger2Y += 0.5;
    fill(0);
    ellipse(passenger2X, passenger2Y, 5, 5);
    strokeWeight(2);
    stroke(0);
    line(passenger2X, passenger2Y, passenger2X, passenger2Y + 5);
  } else if (passenger2Y > 400) {
    passenger2Falling = false;
  }
}

void playerDeath() {

  /*PLAYER ONE DEATH*/
  if (enemyBalloonDefeat == true) {

    enemyBalloonDefeat = false;

    //Checks if player 1 is out of lives
    if (lives > 1) {

      balloonX = 350;
      balloonY = 260;
      lives = lives - 1;
    } else {
      gameOver = true;
    }
  }

  if (balloonY > 360) {

    //Checks if player 1 is out of lives
    if (lives > 1) {

      balloonX = 350;
      balloonY = 260;
      lives = lives - 1;
    } else {
      gameOver = true;
    }
  }

  /*PLAYER TWO DEATH*/
  if (enemyBalloonDefeatP2 == true) {

    enemyBalloonDefeatP2 = false;

    //Checks if the player 2 is out of lives
    if (p2Lives > 0) {

      balloonTwoX = 50;
      balloonTwoY = 260;
      p2Lives = p2Lives - 1;
    } else {
      gameOver = true;
    }
  }

  if (balloonTwoY > 360) {

    //Checks if the player 2 is out of lives
    if (p2Lives > 0) {

      balloonTwoX = 50;
      balloonTwoY = 260;
      p2Lives = p2Lives - 1;
    } else {
      gameOver = true;
    }
  }
}

void drawUI() {

  //Meant to give the players a sense of competition and let them keep track of the game state
  fill(255);
  stroke(0);
  strokeWeight(2);
  rect(355, 372, 100, 55);
  rect(45, 372, 100, 55);
  fill(0);
  textSize(16);
  //Displays player 1 stats at the bottom right underneath P1s spawn area
  text("P1 Score: ", 310, 360);
  text(score, 385, 360);
  text("P1 Lives: ", 310, 390);
  text(lives, 385, 390);
  //Displays player 2 stats at the bottom left underneath P2s spawn area
  text("P2 Score: ", 5, 360);
  text(p2Score, 80, 360);
  text("P2 Lives: ", 5, 390);
  text(p2Lives, 80, 390);
}

void drawTrees() {

  //tree drawing loop to create tree line on bottom of screen
  int trees = 0; //Variable to increment and end loop at 20
  int treeMovement = 0; //Variable to increment and move trees right each time it prints them 

  while (trees <20) {
    //Tree trunk brown
    fill(98, 78, 44); 
    noStroke();
    rectMode(CENTER);
    rect(10 + treeMovement, 390, 8, 35);
    //Pine tree green
    fill(20, 51, 6);
    triangle(2 + treeMovement, 395, 10 + treeMovement, 330, 18 + treeMovement, 395);
    treeMovement += 20;
    trees++;
  }
}

void drawPlayers() {
  /* PLAYER ONE */
  fill(255);
  strokeWeight(1);
  stroke(0);
  //Base Balloon
  ellipse(balloonX-1, balloonY-15, 20, 30);
  fill(17, 17, 152);
  arc(balloonX-1, balloonY-15, 20, 30, PI * 1.5, PI * 2.5);
  fill(255);
  ellipse(balloonX-1, balloonY-15, 10, 30);
  fill(17, 17, 152);
  arc(balloonX-1, balloonY-15, 10, 30, PI * 2.5, PI * 3.5);
  ellipse(balloonX-1, balloonY-15, 1, 30);
  rectMode(CENTER);
  //Spike Metal
  fill(72, 72, 73);
  triangle(balloonX + 3.5, balloonY + 9, balloonX + 3.5, balloonY + 12, balloonX + 10, balloonY + 10); 
  triangle(balloonX - 3.5, balloonY + 9, balloonX - 3.5, balloonY + 12, balloonX - 10, balloonY + 10);
  triangle(balloonX + 3.5, balloonY + 12, balloonX - 3.5, balloonY + 12, balloonX, balloonY + 20); 
  //Basket Brown
  fill(136, 94, 54);
  rect(balloonX, balloonY + 10, 7, 7); 
  line(balloonX + 5, balloonY -1, balloonX + 3.5, balloonY + 10); 
  line(balloonX - 6, balloonY -1, balloonX - 3.5, balloonY + 10);

  /* PLAYER TWO */
  fill(139, 0, 0);
  strokeWeight(1);
  stroke(0);
  //Base Balloon
  ellipse(balloonTwoX-1, balloonTwoY-15, 20, 30);
  fill(255);
  arc(balloonTwoX-1, balloonTwoY-15, 20, 30, PI * 1.5, PI * 2.5);
  fill(139, 0, 0);
  ellipse(balloonTwoX-1, balloonTwoY-15, 10, 30);
  fill(255);
  arc(balloonTwoX-1, balloonTwoY-15, 10, 30, PI * 2.5, PI * 3.5);
  ellipse(balloonTwoX-1, balloonTwoY-15, 1, 30);
  rectMode(CENTER);
  //Spike Metal
  fill(72, 72, 73);
  triangle(balloonTwoX + 3.5, balloonTwoY + 9, balloonTwoX + 3.5, balloonTwoY + 12, balloonTwoX + 10, balloonTwoY + 10); 
  triangle(balloonTwoX - 3.5, balloonTwoY + 9, balloonTwoX - 3.5, balloonTwoY + 12, balloonTwoX - 10, balloonTwoY + 10);
  triangle(balloonTwoX + 3.5, balloonTwoY + 12, balloonTwoX - 3.5, balloonTwoY + 12, balloonTwoX, balloonTwoY + 20); 
  //Basket Brown
  fill(136, 94, 54);
  rect(balloonTwoX, balloonTwoY + 10, 7, 7); 
  line(balloonTwoX + 5, balloonTwoY -1, balloonTwoX + 3.5, balloonTwoY + 10); 
  line(balloonTwoX - 6, balloonTwoY -1, balloonTwoX - 3.5, balloonTwoY + 10);
}


void drawClouds() {

  //Draws the clouds for the players to rest on and use as cover
  fill(255);
  noStroke();
  //Upper Left Cloud
  ellipse(0, 150, 150, 5);
  arc(0, 150, 40, 40, PI * 2, PI * 3);
  arc(40, 150, 68, 30, PI * 2, PI * 3);

  //Upper Right Cloud
  ellipse(400, 150, 150, 5);
  arc(400, 150, 40, 40, PI * 2, PI * 3);
  arc(360, 150, 68, 30, PI * 2, PI * 3);

  //Lower Left Cloud
  ellipse(0, 300, 200, 5);
  arc(0, 300, 40, 40, PI * 2, PI * 3);
  arc(40, 300, 118, 30, PI * 2, PI * 3);

  //Lower Right Cloud
  ellipse(400, 300, 200, 5);
  arc(400, 300, 40, 40, PI * 2, PI * 3);
  arc(360, 300, 118, 30, PI * 2, PI * 3);

  //Middle Cloud
  ellipse(200, 300, 40, 5);
  arc(190, 300, 20, 15, PI * 2, PI * 3);
  arc(210, 300, 20, 15, PI * 2, PI * 3);
}


void collision() {

  /*AIRPLANE BALLOON COLLISION*/

  if (airplaneRandom == false) {
    airplane1 = random(-200, -800);
    airplane2 = random(450, 800);
    airplaneRandom = true;
  }

  //Steel grey
  stroke(1);
  fill(175); 
  //Upper Plane
  rect(airplane1 + (frameCount*1.5%1000), 20, 100, 20, 12);  
  quad((airplane1 - 30) + (frameCount*1.5%1000), 20, (airplane1 - 50) + (frameCount*1.5%1000), 20, (airplane1 - 50) +(frameCount*1.5%1000), 0, (airplane1 - 40) + (frameCount*1.5%1000), 0); 
  //Dark Blue
  fill(0, 0, 139);
  //Upper Plane Windows
  ellipse((airplane1 + 30) + (frameCount*1.5%1000), 20, 5, 8);
  ellipse((airplane1 + 20) + (frameCount*1.5%1000), 20, 5, 8);
  ellipse((airplane1 + 10) + (frameCount*1.5%1000), 20, 5, 8);
  ellipse((airplane1) + (frameCount*1.5%1000), 20, 5, 8);
  ellipse((airplane1 - 10) + (frameCount*1.5%1000), 20, 5, 8);
  ellipse((airplane1 - 20) + (frameCount*1.5%1000), 20, 5, 8);
  //Lower Plane
  fill(175, 175, 175);
  rect(airplane2 - (frameCount*1.5%1000), 60, 100, 20, 12);
  quad((airplane2 +30) - (frameCount*1.5%1000), 60, (airplane2 + 50) - (frameCount*1.5%1000), 60, (airplane2 + 50) - (frameCount*1.5%1000), 40, (airplane2 + 40) - (frameCount*1.5%1000), 40);
  //Dark Blue
  fill(0, 0, 139);
  //Lower Plane Windows
  ellipse((airplane2 -30) - (frameCount*1.5%1000), 60, 5, 8);
  ellipse((airplane2 + 20) - (frameCount*1.5%1000), 60, 5, 8);
  ellipse((airplane2 + 10) - (frameCount*1.5%1000), 60, 5, 8);
  ellipse((airplane2) - (frameCount*1.5%1000), 60, 5, 8);
  ellipse((airplane2 - 10) - (frameCount*1.5%1000), 60, 5, 8);
  ellipse((airplane2 - 20) - (frameCount*1.5%1000), 60, 5, 8);

  //Airplanes hitting Player 1
  if ((airplane1 + (frameCount*1.5%1000) > balloonX - 60) && (airplane1 + (frameCount*1.5%1000) < balloonX + 60) && balloonY > 0 && balloonY < 40) {

    enemyBalloonDefeat  = true;
  }

  if ((airplane2 - (frameCount*1.5%1000) > balloonX - 60) && (airplane2 - (frameCount*1.5%1000) < balloonX + 60) && (balloonY > 50) && (balloonY < 70)) {

    enemyBalloonDefeat  = true;
  }

  //Airplanes hitting Player 2
  if ((airplane1 + (frameCount*1.5%1000) > balloonTwoX - 60) && (airplane1 + (frameCount*1.5%1000) < balloonTwoX + 60) && balloonTwoY > 0 && balloonTwoY < 40) {

    enemyBalloonDefeatP2  = true;
  }

  if ((airplane2 - (frameCount*1.5%1000) > balloonTwoX - 60) && (airplane2 - (frameCount*1.5%1000) < balloonTwoX + 60) && (balloonTwoY > 50) && (balloonTwoY < 70)) {

    enemyBalloonDefeatP2  = true;
  }


  /*ENEMY BALLOON COLLISION*/

  //Player 2 is hit
  if ((balloonY < balloonTwoY-10) && (balloonY > balloonTwoY -38) && (balloonX < balloonTwoX +20) && (balloonX > balloonTwoX -20)) {
    enemyBalloonDefeatP2 = true;
  }

  //Player 1 is hit
  if ((balloonTwoY < balloonY-10) && (balloonTwoY > balloonY -38) && (balloonTwoX < balloonX +20) && (balloonTwoX > balloonX -20)) {
    enemyBalloonDefeat = true;
  }


  /*P1 CLOUD COLLISION*/
  //Upper Left Cloud Collision
  if ((balloonY + 12.5 > 150) && (balloonY + 12.5 < 155) && (balloonX < 75)) {
    balloonGravity = 0;
  }
  //Uper Right Cloud Collision
  else if ((balloonY + 12.5 > 150) && (balloonY + 12.5 < 155) && (balloonX > 325)) {
    balloonGravity = 0;
  }
  ////Lower Left Cloud Collision
  else if ((balloonY + 12.5 > 300) && (balloonY + 12.5 < 305) && (balloonX < 100)) {
    balloonGravity = 0;
  }
  //Lower Right Cloud Collision
  else if ((balloonY + 12.5 > 300) && (balloonY + 12.5 < 305) && (balloonX > 300)) {
    balloonGravity = 0;
  }
  //Middle Cloud Collision
  else if ((balloonY + 12.5 > 300) && (balloonY + 12.5 < 305) && (balloonX > 180) && (balloonX < 220)) {
    balloonGravity = 0;
  }
  //If not colliding with cloud
  else {
    balloonGravity = 0.8;
  }

  /*P2 CLOUD COLLISION*/
  //Upper Left Cloud Collision
  if ((balloonTwoY + 12.5 > 150) && (balloonTwoY + 12.5 < 155) && (balloonTwoX < 75)) {
    balloonTwoGravity = 0;
  }
  //Uper Right Cloud Collision
  else if ((balloonTwoY + 12.5 > 150) && (balloonTwoY + 12.5 < 155) && (balloonTwoX > 325)) {
    balloonTwoGravity = 0;
  }
  ////Lower Left Cloud Collision
  else if ((balloonTwoY + 12.5 > 300) && (balloonTwoY + 12.5 < 305) && (balloonTwoX < 100)) {
    balloonTwoGravity = 0;
  }
  //Lower Right Cloud Collision
  else if ((balloonTwoY + 12.5 > 300) && (balloonTwoY + 12.5 < 305) && (balloonTwoX > 300)) {
    balloonTwoGravity = 0;
  }
  //Middle Cloud Collision
  else if ((balloonTwoY + 12.5 > 300) && (balloonTwoY + 12.5 < 305) && (balloonTwoX > 180) && (balloonTwoX < 220)) {
    balloonTwoGravity = 0;
  }
  //If not colliding with cloud
  else {
    balloonTwoGravity = 0.8;
  }

  /*P1 BOUNDS COLLISION*/
  //Check if out of bounds on left puts it on right of screen
  if (balloonX < 0) {
    balloonX = 399;
  }
  //Check if out of bounds on right puts it on the left of screen
  if (balloonX > 400) {
    balloonX = 1;
  }

  /*P2 BOUNDS COLLISION*/
  //Check if out of bounds on left puts it on right of screen
  if (balloonTwoX < 0) {
    balloonTwoX = 399;
  }
  //Check if out of bounds on right puts it on the left of screen
  if (balloonTwoX > 400) {
    balloonTwoX = 1;
  }
}

void buttonInput() {

  /* PLAYER ONE INPUT */
  //Move left
  if (leftKey == true) {
    balloonX = balloonX + balloonSpeed;
  }

  //Move right
  if (rightKey == true) {
    balloonX = balloonX + balloonSpeed;
  }

  //Keeps balloon within bounds
  if ((balloonY - 12.5) < 0) {
    balloonY = balloonY + balloonGravity;
  }
  //Move up if its in bounds and up key is pressed
  else if (up == true) {
    balloonY = balloonY + balloonLift;
    //Otherwise fall
  } else {
    balloonY = balloonY + balloonGravity;
  }

  /* PLAYER TWO INPUT */
  //Move left
  if (pTwoLeftKey == true) {
    balloonTwoX = balloonTwoX + balloonTwoSpeed;
  }

  //Move right
  if (pTwoRightKey == true) {
    balloonTwoX = balloonTwoX + balloonTwoSpeed;
  }

  //Keeps balloon within bounds
  if ((balloonTwoY - 12.5) < 0) {
    balloonTwoY = balloonTwoY + balloonTwoGravity;
  }
  //Move up if its in bounds and up key is pressed
  else if (p2Up == true) {
    balloonTwoY = balloonTwoY + balloonTwoLift;
    //Otherwise fall
  } else {
    balloonTwoY = balloonTwoY + balloonTwoGravity;
  }
}

//Key press and releases assigned to variables for use in buttonInput
void keyPressed() {

  if (keyCode == ENTER) {
    enter = true;
  }

  //Player 1 keys
  if (key == CODED) {
    if (keyCode == LEFT) {
      leftKey = true;
      rightKey = false;
      balloonSpeed = -1;
    }
  }

  if (key == CODED) {
    if (keyCode == RIGHT) {
      rightKey = true;
      leftKey = false;
      balloonSpeed = 1;
    }
  }

  if (key == CODED) {
    if (keyCode == UP) {
      up = true;
      balloonLift = -2;
    }
  }


  //Player two keys
  if (key == 'a') {

    pTwoLeftKey = true;
    pTwoRightKey = false;
    balloonTwoSpeed = -1;
  }

  if (key == 'd') {

    pTwoRightKey = true;
    pTwoLeftKey = false;
    balloonTwoSpeed = 1;
  }


  if (key == 'w') {
    p2Up = true;
    balloonTwoLift = -2;
  }
}


void keyReleased() {

  //Player one keys
  if (key == CODED) {
    if (keyCode == LEFT) {
      leftKey = false;
    }
  }

  if (key == CODED) {
    if (keyCode == RIGHT) {
      rightKey = false;
    }
  }

  if (key == CODED) {
    if (keyCode == UP) {
      up = false;
    }
  }

  //Player two keys
  if (key == 'a') {

    pTwoLeftKey = false;
  }

  if (key == 'd') {

    pTwoRightKey = false;
  }

  if (key == 'w') {
    p2Up = false;
  }
}



void drawBackground() {


  //Cornfield blue
  background(100, 149, 237);

  //Creates random cloud values everytime
  if (cloudNumbers == false) {
    //Cloud random sizes
    cloud1X = random(-200, -800);
    cloud1Y = random(20, 250);
    cloud1SizeX = random(100, 300);
    cloud1SizeY = random(20, 50);
    cloud1Speed = random(900, 2000);

    cloud2X = random(-200, -400);
    cloud2Y = random(20, 250);
    cloud2SizeX = random(100, 300);
    cloud2SizeY = random(20, 50);
    cloud2Speed = random(900, 2000);

    cloud3X = random(-200, -400);
    cloud3Y = random(20, 250);
    cloud3SizeX = random(100, 300);
    cloud3SizeY = random(20, 50);
    cloud3Speed = random(900, 2000);

    cloud4X = random(-200, -400);
    cloud4Y = random(20, 250);
    cloud4SizeX = random(100, 300);
    cloud4SizeY = random(20, 50);
    cloud4Speed = random(900, 2000);

    cloud5X = random(-200, -400);
    cloud5Y = random(20, 250);
    cloud5SizeX = random(100, 300);
    cloud5SizeY = random(20, 50);
    cloud5Speed = random(900, 2000);

    cloud6X = random(600, 800);
    cloud6Y = random(20, 250);
    cloud6SizeX = random(100, 300);
    cloud6SizeY = random(20, 50);
    cloud6Speed = random(900, 2000);

    cloud7X = random(600, 800);
    cloud7Y = random(20, 250);
    cloud7SizeX = random(100, 300);
    cloud7SizeY = random(20, 50);
    cloud7Speed = random(900, 2000);

    cloud8X = random(600, 800);
    cloud8Y = random(20, 250);
    cloud8SizeX = random(100, 300);
    cloud8SizeY = random(20, 50);
    cloud8Speed = random(900, 2000);

    cloud9X = random(600, 800);
    cloud9Y = random(20, 250);
    cloud9SizeX = random(100, 300);
    cloud9SizeY = random(20, 50);
    cloud9Speed = random(900, 2000);

    cloud10X = random(600, 800);
    cloud10Y = random(20, 250);
    cloud10SizeX = random(100, 300);
    cloud10SizeY = random(20, 50);
    cloud10Speed = random(1500, 3000);
  }

  cloudNumbers = true;

  //Background transparent clouds coming in from either side
  noStroke();
  fill(255, 100);
  //Leftbound clouds
  ellipse(cloud1X + (frameCount*0.5%cloud1Speed), cloud1Y, cloud1SizeX, cloud1SizeY);  
  ellipse(cloud2X + (frameCount*0.4%cloud2Speed), cloud2Y, cloud2SizeX, cloud2SizeY);  
  ellipse(cloud3X + (frameCount*0.3%cloud3Speed), cloud3Y, cloud3SizeX, cloud3SizeY);  
  ellipse(cloud4X + (frameCount*0.2%cloud4Speed), cloud4Y, cloud4SizeX, cloud4SizeY); 
  ellipse(cloud5X + (frameCount*0.1%cloud5Speed), cloud5Y, cloud5SizeX, cloud5SizeY); 

  //Rightbound clouds
  ellipse(cloud6X - (frameCount*0.5%cloud6Speed), cloud6Y, cloud6SizeX, cloud6SizeY); 
  ellipse(cloud7X - (frameCount*0.4%cloud7Speed), cloud7Y, cloud7SizeX, cloud7SizeY); 
  ellipse(cloud8X - (frameCount*0.3%cloud8Speed), cloud8Y, cloud8SizeX, cloud8SizeY); 
  ellipse(cloud9X - (frameCount*0.2%cloud9Speed), cloud9Y, cloud9SizeX, cloud9SizeY); 
  ellipse(cloud10X - (frameCount*0.1%cloud10Speed), cloud10Y, cloud10SizeX, cloud10SizeY);
}