Answered You can hire a professional tutor to get the answer.

QUESTION

package gotcha_pkg; import processing.PApplet; import processing.PFont; import java.

package gotcha_pkg;

import processing.core.PApplet;

import processing.core.PFont;

import java.util.ArrayList;

public class Gotcha_Multi extends PApplet {

  // Timer

  int timer;

  // Game length in milliseconds

  int gameDuration = 10 * 1000;

  // Keep track of current score

  static int score = 0;

  // Canvas size

  final int canvasWidth = 500;

  final int canvasHeight = 500;

  final int maxDisks = 2;

  // Declare y values for starting point

  float[] yValue = {70, 140};

  // Create disks

  // With ArrayList:

  ArrayList<Disk> dList = TODO

  public static void main(String[] args){

    PApplet.main("gotcha_pkg.Gotcha_Multi");

  }

  public void settings() {

    size(canvasWidth, canvasHeight);

    smooth();

  }

  // Setup runs one time at the beginning of your program

  public void setup() {    

    // Set time now

    timer = millis() + gameDuration;

    for (int i = 0; i < maxDisks; i++) {

      // With ArrayList

      dList.TODO(new Disk(random(0, 255), random(0, 255), random(0, 255),

          random(0, 255), yValue[i], 2 + (2 * i)));

      System.out.println("nNumber of Disks: " + dList.size() + "n");

    }

  }

  // Draw is called in an infinite loop.

  // By default, it is called about 60 times per second.

  public void draw() {

    // Erase the background, if you don't, the previous shape will 

    // still be displayed

    eraseBackground();

    // Move the shape, i.e. calculate the next x and y position

    // where the shape will be drawn. Draw the shape, display point

    // value.

    for (int j = 0; j < maxDisks; j++) {

      dList.TODO.calcCoords();

      dList.TODO.drawShape();

      // TODO: Display the point value on the shape

    }

    // Display player's score

    //TODO: Display score

    if (millis() >= timer) { // Game over

      // Clear the canvas

      background(0, 0, 255);

      // Output the final score

      // TODO: Output final score

      // Let the user click when finished reading score

      // TODO: Output message to click mouse to exit

      if (this.mousePressed) {    

       // Exit

       System.exit(0);

      }

    }

  }

  public void eraseBackground() {

    background(255);

  }

  // mousePressed is a PApplet method that you can override.

  // This method is designed to be called one time when the mouse is pressed

  public void mousePressed() {

   // Draw a circle wherever the mouse is

   int mouseWidth = 20;

   int mouseHeight = 20;

   fill(0, 255, 0);

   ellipse(this.mouseX, this.mouseY, mouseWidth, mouseHeight);

   // Check whether the click occurred within range of a shape

   for (int i = 0; i < maxDisks; i++) {

    if ((this.mouseX >= (dList.TODO.x - dList.TODO.targetRange)) && 

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question