예제 #1
0
  /** Draws status bar for Black Hole */
  private void drawPoison() {

    myImage.setColor(Color.BLACK);
    myImage.drawString("Black Hole", 10, 30);
    bar.setColor(Color.BLACK);
    bar.fill();
  }
예제 #2
0
  /** Draws status bar for Fire Power */
  private void drawIce() {

    myImage.setColor(Color.RED); // Set the color of myImage blue
    myImage.drawString("Fire Power", 10, 30); // display text "Fire Power" at a location on myImage
    bar.setColor(Color.RED); // set the color of the image bar as blue
    bar.fill(); // fill the image bar with blue
  }
예제 #3
0
  /** Draws status bar for Invincibility */
  private void drawStun() {

    myImage.setColor(Color.YELLOW);
    myImage.drawString("Invincibility", 10, 30);
    bar.setColor(Color.YELLOW);
    bar.fill();
  }
예제 #4
0
  /** Draws status bar for Flight */
  private void drawFire() {

    myImage.setColor(Color.BLUE); // Set the color of myImage red
    myImage.drawString("Flight", 10, 30); // display text "Flight" at a location on myImage
    bar.setColor(Color.BLUE); // set the color of the image bar as red
    bar.fill(); // fill the image bar with red
  }
  public TrafficWorld() {
    super(WORLD_WIDTH, WORLD_HEIGHT, CELL_SIZE);
    GreenfootImage background = this.getBackground();
    background.setColor(Color.GREEN);
    background.fill();

    for (int n = 0; n < Y_ROADS; n++) {
      int Y_INC = (((Road.Y_GAP_SIZE + Road.ROAD_HEIGHT) * n) + (Road.ROAD_HEIGHT / 2));

      HorizontalRoads[n] = new Road();
      this.addObject(HorizontalRoads[n], (WORLD_WIDTH / 2), Y_INC);
    }

    for (int n = 0; n < X_ROADS; n++) {
      int X_INC = (((Road.X_GAP_SIZE + Road.ROAD_HEIGHT) * n) + (Road.ROAD_HEIGHT / 2));

      VerticalRoads[n] = new Road();
      this.addObject(VerticalRoads[n], X_INC, (WORLD_HEIGHT / 2));
      VerticalRoads[n].turn(90);
    }

    for (int x = 0; x < X_ROADS; x++) {
      for (int y = 0; y < Y_ROADS; y++) {
        Intersection intersection = new Intersection();
        this.addObject(intersection, VerticalRoads[x].getX(), HorizontalRoads[y].getY());
        intersection.addLights();
      }
    }
  }
예제 #6
0
 private void drawBox() {
   amarelo = new Color(255, 188, 0);
   laranja = new Color(255, 133, 0);
   imgHelp = getImage();
   imgHelp.setColor(laranja);
   imgHelp.fill();
   imgHelp.scale(200, 50);
   imgHelp.setColor(amarelo);
   int margem = 5;
   int largura = imgHelp.getWidth() - 2 * margem;
   int altura = imgHelp.getHeight() - 2 * margem;
   imgHelp.fillRect(margem, margem, largura, altura);
 }
예제 #7
0
  /**
   * Change the background colour of this Button
   *
   * @param background The colour to use
   */
  public void update(Color background) {
    GreenfootImage tempTextImage =
        new GreenfootImage(buttonText, textSize, Color.BLACK, background);

    myImage = new GreenfootImage(tempTextImage.getWidth() + 8, tempTextImage.getHeight() + 8);
    myImage.setColor(Color.BLACK);
    myImage.fill();
    myImage.drawImage(tempTextImage, 4, 4);

    myImage.setColor(Color.BLACK);
    myImage.drawRect(0, 0, tempTextImage.getWidth() + 7, tempTextImage.getHeight() + 7);
    setImage(myImage);
  }
예제 #8
0
  /**
   * Change the text displayed on this Button
   *
   * @param text String to display
   */
  public void update(String text) {
    Color buttonFill = new Color(242, 206, 27); // yellow fill colour

    buttonText = text;
    GreenfootImage tempTextImage = new GreenfootImage(text, 20, Color.BLACK, buttonFill);
    myImage = new GreenfootImage(tempTextImage.getWidth() + 8, tempTextImage.getHeight() + 8);
    myImage.setColor(Color.BLACK);
    myImage.fill();
    myImage.drawImage(tempTextImage, 4, 4);

    myImage.setColor(Color.BLACK);
    myImage.drawRect(0, 0, tempTextImage.getWidth() + 7, tempTextImage.getHeight() + 7);
    setImage(myImage);
  }