Index / 2016 / Quiz 06 Mission 08
400×300 · p5.js instance mode
Quiz_06_Mission_08.pde 71 lines
int xpos1 = 0;
int ypos1 = 110;
int yspeed = 3;
color c1 = #ABDDE5;

float xpos2 = 200;
float ypos2 = 50;
float velocity = 0;
float gravity = 0.35;
float breeze = 0.5;
float bounce = -1;

void setup() {
  size(400,300);
  background(#ABDDE5);
}

void draw() {
  background(c1);
  
  if (keyPressed) {
    if (key == 'r') {
      c1 = #F02C50;
    } else if (key == 'g') {
      c1 = #;
    } else if (key == 'y') {
      c1 = #F7E86E;
    }
  }
  
  fill(#);
  ellipse(200,150,100,100);
  
  fill(#);
  ellipse(xpos1,150,20,20);
  xpos1 += 1;
  
  fill(#F23D3D);
  rect(160,ypos1,80,80);
  ypos1 += yspeed;
  
  if (ypos1 >= 220 || ypos1 <= 0) {
    yspeed = yspeed*-1;
  }
  
  fill(#);
  ellipse(mouseX,mouseY,20,20);
  

  fill(#E269F2);
  ellipse(xpos2,ypos2,20,20);
  
  velocity += gravity;
  ypos2 += velocity;
  xpos2 += breeze;
  
  if(ypos2 > 280)
  {
    velocity *= bounce;
  }
  
  if (xpos2 >= 400) {
    breeze *= -1;
  }
  
  if (xpos2 < 19) {
    gravity = 0;
    velocity = 0;
    breeze = 0;
  }
}
read-only archive source from /2016/QUIZZES/Q-06 Processing 1/ICS20_Nguyen,Vincent_Q-06 Mission 08/Quiz_06_Mission_08/Quiz_06_Mission_08.pde

Description

This page is generated from the Processing project folder at /2016/QUIZZES/Q-06 Processing 1/ICS20_Nguyen,Vincent_Q-06 Mission 08/Quiz_06_Mission_08/Quiz_06_Mission_08.pde.

Archive

No companion assets were found in this sketch folder.