Ejemplo n.º 1
0
 public void gameOverMenu(
     Graphics g) { // CHANGE THIS TO INCLUDE HIGHSCORES AND STUFF AFTER TEXTFILES ARE MADE
   // Menu that shows up when user gets Game Over
   if (pause == true && die == true) {
     g.drawImage(
         new ImageIcon("InGameMenu/pauseBckgrnd.png").getImage(), 0, 0, this); // Graphics stuff
     g.setFont(scoreFont);
     g.setColor(Color.BLACK);
     g.drawImage(new ImageIcon("InGameMenu/GameOver.png").getImage(), 10, 200, this);
     displayScore2(g, 115, 350, 185, 385, 110, 440, 110, 490); // Shows stats
     g.drawImage(menuB.getPic(mx, my), menuB.getX(), menuB.getY(), this); // Draws menu button
   }
 }
Ejemplo n.º 2
0
 // ------------------------------------------------------------------------------------------------------------------------------------
 // Buttons clicked
 public void pauseClicked() {
   // Pauses game
   // Checks if pause button is clicked
   if (pauseB.clicked(mx, my, true) && pause == false) {
     clickedSound();
     pause = true;
   }
 }
Ejemplo n.º 3
0
  public void musicClicked() {
    // Mutes/unmutes music
    // checks to see if mute/unmute button is clicked
    if (muteB.clicked(mx, my, true) && pause == true && musicOn == true) {
      clickedSound();
      musicOn = false;
      clicked.stop();
      bckGrndMusic.stop();
      coinSound.stop();
      starSound.stop();
      bounce.stop();

    } else if (unmuteB.clicked(mx, my, true) && pause == true && musicOn == false) {
      clickedSound();
      musicOn = true;
      bckGrndMusic.loop();
    }
  }
Ejemplo n.º 4
0
 public void resumeClicked() {
   // Resumes game
   // Checks if resume button is clicked
   if (resumeB.clicked(mx, my, true) && pause == true && die == false) {
     clickedSound();
     pause = false;
     lvlClear = false;
   }
 }
Ejemplo n.º 5
0
 public void menuClicked() {
   // Returns to back menu
   // Checks to see if back button has been clicked
   if (menuB.clicked(mx, my, true) && pause == true) {
     clickedSound();
     screen = "menu";
     pause = false;
     die = false;
   }
 }
Ejemplo n.º 6
0
 /** Fire back button only once and if some time already passed by to avoid double clicks. */
 private void fireDefaultBackButton() {
   final int TIME_TO_ASSUME_DOUBLECLICKS_MS = 750;
   if (this.backButton != null) {
     long currentTime = System.currentTimeMillis();
     if (currentTime - defaultBackButtonLastPressedTime > TIME_TO_ASSUME_DOUBLECLICKS_MS) {
       // Simulate a button press
       backButton.processLowLevelEvent(null, new String[] {"1"});
     }
     defaultBackButtonLastPressedTime = currentTime;
   }
 }
Ejemplo n.º 7
0
 // -------------------------------------------------------------------------------------------------------------------------------------------------------
 // Graphics
 public void paintComponent(Graphics g) {
   if (pause
       == false) { // if the pause screen is paused then don't move anything and go to the pause
     // screen
     DrawEveryThing(g);
     displayScore(g, 10, 10, 80, 42, 300, 60, 300, 32); // shows the score
     drawPowerUpIcon(g); // draws the powerup icon
     g.drawImage(
         pauseB.getPic(mx, my),
         pauseB.getX(),
         pauseB.getY(),
         this); // Pause button in bottom right-head corner
     changeHeight(); // changes the height
     if (die) {
       showDieMenu();
     }
   } else {
     pauseMenu(
         g); // draws the pause menu , lvlClearmenu or gameOverMenu  depending what screen the user
     // wants to go to
     lvlClearMenu(g);
     gameOverMenu(g);
   }
 }
Ejemplo n.º 8
0
 public void lvlClearMenu(Graphics g) {
   // Menu that shows up after a level has been cleared
   if (pause == true && lvlClear == true) {
     g.drawImage(
         new ImageIcon("InGameMenu/pauseBckgrnd.png").getImage(), 0, 0, this); // <Graphics stuff
     g.drawImage(new ImageIcon("InGameMenu/stageClearPic.png").getImage(), 100, 0, this);
     displayScore2(g, 115, 350, 185, 380, 110, 440, 110, 490); // Displays stats
     g.drawImage(
         resumeB.getPic(mx, my), resumeB.getX(), resumeB.getY(), this); // Draws resume button
     g.drawImage(
         menuB.getPic(mx, my), menuB.getX(), menuB.getY(), this); // Draws the back to menu button
   }
 }
Ejemplo n.º 9
0
  public SAnchorYearMonthChooser() {
    super(new SFlowLayout(CENTER));

    getSession().addPropertyChangeListener(Session.LOCALE_PROPERTY, this);
    initLocaleDependent();

    backward.setIcon(new SResourceIcon("icons/ScrollLeft.gif"));
    backward.setToolTipText("&lt;");
    backward.setVerticalTextPosition(TOP);
    backward.setHorizontalTextPosition(RIGHT);
    backward.setShowAsFormComponent(false);
    backward.addActionListener(this);

    forward.setIcon(new SResourceIcon("icons/ScrollRight.gif"));
    forward.setToolTipText("&gt;");
    forward.setVerticalTextPosition(TOP);
    forward.setHorizontalTextPosition(RIGHT);
    forward.setShowAsFormComponent(false);
    forward.addActionListener(this);

    add(backward);
    add(label);
    add(forward);

    set(new java.util.GregorianCalendar(getLocale()));
  }
Ejemplo n.º 10
0
 protected void repaint() {
   forward.setVisible((year * 100 + month) < maximum);
   backward.setVisible((year * 100 + month) > minimum);
   label.setText(" " + monthLabels[month] + " " + year + " ");
 }
Ejemplo n.º 11
0
  // ------------------------------------------------------------------------------------------------------------------------------------
  // In game menus
  public void pauseMenu(Graphics g) {
    // Pause menu
    if (pause == true && lvlClear == false) {
      g.setFont(scoreFont);
      g.setColor(Color.BLACK);
      g.drawImage(new ImageIcon("InGameMenu/pauseBckgrnd.png").getImage(), 0, 0, this);
      g.drawString("P A U S E D", 155, 200);
      displayScore2(g, 115, 350, 185, 380, 110, 440, 110, 490); // Displays stats
      g.drawImage(
          resumeB.getPic(mx, my), resumeB.getX(), resumeB.getY(), this); // Draws the resume button
      g.drawImage(
          menuB.getPic(mx, my), menuB.getX(), menuB.getY(), this); // Draws the back to menu button

      if (musicOn == true) { // Draws the mute or unmute button (based on if music is on or not)
        g.drawImage(muteB.getPic(mx, my), muteB.getX(), muteB.getY(), this);
      }
      if (musicOn == false) {
        g.drawImage(unmuteB.getPic(mx, my), unmuteB.getX(), unmuteB.getY(), this);
      }
    }
  }
Ejemplo n.º 12
0
 public void setCG(MenuBarCG cg) {
   super.setCG(cg);
 }