Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-mini-2025-04-14· OpenAIAi2 WildChat-4.8M (AI2)

Solve this entire Processing exercise with no aditional comments or explanations, simply…

  1. User

    Solve this entire Processing exercise with no aditional comments or explanations, simply give me the altered code already solved: {// lastname : // firstname : // class : // student number:

    /*

    2a) Control the jumping of the frog by using a specific keyboard key.

    When the "g-key is "pressed" : The frog should jump 180 pixels to the right only once. The frog will jump to next water lily leaf when pressed again.

    The xFrog value will already be reset to the first leaf when it jumps out of the screen.

    2b) Control the presence of the lily leaves and the y-position of the frog by using specific keyboard keys.

    Mousebutton pressed : the water lily leaves are not visible, and the frog should go down on the screen. Mousebutton released : the water lily leaves are visible, and the y-position of the frog is set back to 400 so it sits back on a water lily leaf again

    Check the movie for a visual representation. Use the given variables to make your work easy, but there might be more variables than you need. Don't change the given function. Just use both only once, like at the start. Only change variables under the given conditions.

    */

    color white = color(251); color black = color(4); color blue = color(1, 54, 154); color brightGreen = color (14, 154, 71); color darkGreen = color(74, 114, 54); color leafGreen = color (104, 154, 94);

    int size = 2; int xFrog = 70; int yFrog = 400; int xSpeed = -1; int ySpeed = -1; int stepSize = 1; int jump = 180;

    boolean isJumping = false; boolean isFalling = false;

    void setup() size (800, 800);

    void draw() { background(blue);

    drawLeaves();

    drawFrog();

    if(xFrog > width) xFrog = 70;

    }

    void drawFrog()

    // Fuction draws the frog with the values of xFrog and yFrog. See it as a black box. // Don't Change pushMatrix(); translate(xFrog-750, yFrog-550);

    noStroke(); //head fill (brightGreen); ellipse(750, 550, 100, 75); ellipse(775, 510, 40, 40); ellipse(725, 510, 40, 40); // eyes fill(white); ellipse(775, 510, 24, 24); ellipse(725, 510, 24, 24); fill(black); ellipse(775, 510, 12, 12); ellipse(725, 510, 12, 12); fill(white); ellipse(772, 512, 2, 2); ellipse(728, 512, 2, 2); //nose fill (darkGreen); ellipse(762, 550, 8, 8); ellipse(738, 550, 8, 8); // Mouth stroke(black); noFill(); strokeWeight(size); arc(750, 556, 60, 40, radians(45), radians(135)); popMatrix();

    void drawLeaves() // Fuction below draws some waterlili leafs. See it as a black box. // Don't change. pushMatrix(); translate(0, -100); fill(leafGreen); stroke(5, 75, 38); strokeWeight(2); arc(330, 420, 180, 120, radians(130), radians(360+110), PIE); arc(560, 400, 180, 120, radians(140), radians(360+120), PIE); arc(70, 550, 180, 120, radians(120), radians(360+100), PIE); arc(250, 530, 180, 120, radians(135), radians(360+115), PIE); arc(430, 550, 180, 120, radians(160), radians(360+140), PIE); arc(610, 530, 180, 120, radians(180), radians(360+160), PIE); arc(790, 550, 180, 120, radians(170), radians(360+150), PIE); arc(330, 660, 180, 120, radians(130), radians(360+110), PIE); arc(560, 680, 180, 120, radians(140), radians(360+120), PIE); popMatrix();

    // lastname : // firstname : // class : // student number:

    /*

    2a) Control the jumping of the frog by using a specific keyboard key.

    When the "g-key is "pressed" : The frog should jump 180 pixels to the right only once. The frog will jump to next water lily leaf when pressed again.

    The xFrog value will already be reset to the first leaf when it jumps out of the screen.

    2b) Control the presence of the lily leaves and the y-position of the frog by using specific keyboard keys.

    Mousebutton pressed : the water lily leaves are not visible, and the frog should go down on the screen. Mousebutton released : the water lily leaves are visible, and the y-position of the frog is set back to 400 so it sits back on a water lily leaf again

    Check the movie for a visual representation. Use the given variables to make your work easy, but there might be more variables than you need. Don't change the given function. Just use both only once, like at the start. Only change variables under the given conditions.

    */

    color white = color(251); color black = color(4); color blue = color(1, 54, 154); color brightGreen = color (14, 154, 71); color darkGreen = color(74, 114, 54); color leafGreen = color (104, 154, 94);

    int size = 2; int xFrog = 70; int yFrog = 400; int xSpeed = -1; int ySpeed = -1; int stepSize = 1; int jump = 180;

    boolean isJumping = false; boolean isFalling = false;

    void setup() size (800, 800);

    void draw() { background(blue);

    drawLeaves();

    drawFrog();

    if(xFrog > width) xFrog = 70;

    }

    void drawFrog()

    // Fuction draws the frog with the values of xFrog and yFrog. See it as a black box. // Don't Change pushMatrix(); translate(xFrog-750, yFrog-550);

    noStroke(); //head fill (brightGreen); ellipse(750, 550, 100, 75); ellipse(775, 510, 40, 40); ellipse(725, 510, 40, 40); // eyes fill(white); ellipse(775, 510, 24, 24); ellipse(725, 510, 24, 24); fill(black); ellipse(775, 510, 12, 12); ellipse(725, 510, 12, 12); fill(white); ellipse(772, 512, 2, 2); ellipse(728, 512, 2, 2); //nose fill (darkGreen); ellipse(762, 550, 8, 8); ellipse(738, 550, 8, 8); // Mouth stroke(black); noFill(); strokeWeight(size); arc(750, 556, 60, 40, radians(45), radians(135)); popMatrix();

    void drawLeaves() // Fuction below draws some waterlili leafs. See it as a black box. // Don't change. pushMatrix(); translate(0, -100); fill(leafGreen); stroke(5, 75, 38); strokeWeight(2); arc(330, 420, 180, 120, radians(130), radians(360+110), PIE); arc(560, 400, 180, 120, radians(140), radians(360+120), PIE); arc(70, 550, 180, 120, radians(120), radians(360+100), PIE); arc(250, 530, 180, 120, radians(135), radians(360+115), PIE); arc(430, 550, 180, 120, radians(160), radians(360+140), PIE); arc(610, 530, 180, 120, radians(180), radians(360+160), PIE); arc(790, 550, 180, 120, radians(170), radians(360+150), PIE); arc(330, 660, 180, 120, radians(130), radians(360+110), PIE); arc(560, 680, 180, 120, radians(140), radians(360+120), PIE); popMatrix();

    }

  2. Assistant
    color white = color(251);
    color black = color(4);
    color blue = color(1, 54, 154);
    color brightGreen = color (14, 154, 71);
    color darkGreen = color(74, 114, 54);
    color leafGreen = color (104, 154, 94);
    
    int size = 2;
    int xFrog = 70;
    int yFrog = 400; 
    int xSpeed = -1;
    int ySpeed = -1;
    int stepSize = 1;
    int jump = 180;
    
    boolean showLeaves = true;
    
    void setup() {
      size (800, 800);
    }
    
    void draw() {
      background(blue);
      
      if(showLeaves) {
        drawLeaves();
      }
      
      drawFrog();
      
      if(xFrog > width) {
        xFrog = 70;
      }
    }
    
    void keyPressed() {
      if(key == 'g' || key == 'G') {
        xFrog += jump;
      }
    }
    
    void mousePressed() {
      showLeaves = false;
      yFrog = height; 
    }
    
    void mouseReleased() {
      showLeaves = true;
      yFrog = 400;
    }
    
    void drawFrog() {
      // Fuction draws the frog with the values of xFrog and yFrog. See it as a black box. 
      // Don't Change
      pushMatrix();
      translate(xFrog-750, yFrog-550); 
    
      noStroke();
      //head
      fill (brightGreen);
      ellipse(750, 550, 100, 75); 
      ellipse(775, 510, 40, 40);
      ellipse(725, 510, 40, 40);
      // eyes
      fill(white);
      ellipse(775, 510, 24, 24);
      ellipse(725, 510, 24, 24);
      fill(black);
      ellipse(775, 510, 12, 12);
      ellipse(725, 510, 12, 12);
      fill(white);
      ellipse(772, 512, 2, 2);
      ellipse(728, 512, 2, 2);
      //nose
      fill (darkGreen);
      ellipse(762, 550, 8, 8);
      ellipse(738, 550, 8, 8);
      // Mouth
      stroke(black);
      noFill();
      strokeWeight(size);
      arc(750, 556, 60, 40, radians(45), radians(135));
      popMatrix();
    }
    
    void drawLeaves() {
      // Fuction below draws some waterlili leafs. See it as a black box. 
      // Don't change.
      pushMatrix();
      translate(0, -100);
      fill(leafGreen);
      stroke(5, 75, 38);
      strokeWeight(2);
      arc(330, 420, 180, 120, radians(130), radians(360+110), PIE);
      arc(560, 400, 180, 120, radians(140), radians(360+120), PIE);
      arc(70, 550, 180, 120, radians(120), radians(360+100), PIE);
      arc(250, 530, 180, 120, radians(135), radians(360+115), PIE);
      arc(430, 550, 180, 120, radians(160), radians(360+140), PIE);
      arc(610, 530, 180, 120, radians(180), radians(360+160), PIE);
      arc(790, 550, 180, 120, radians(170), radians(360+150), PIE); 
      arc(330, 660, 180, 120, radians(130), radians(360+110), PIE);
      arc(560, 680, 180, 120, radians(140), radians(360+120), PIE);
      popMatrix();
    }