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 } }
// ------------------------------------------------------------------------------------------------------------------------------------ // Buttons clicked public void pauseClicked() { // Pauses game // Checks if pause button is clicked if (pauseB.clicked(mx, my, true) && pause == false) { clickedSound(); pause = true; } }
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(); } }
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; } }
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; } }
/** 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; } }
// ------------------------------------------------------------------------------------------------------------------------------------------------------- // 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); } }
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 } }
public SAnchorYearMonthChooser() { super(new SFlowLayout(CENTER)); getSession().addPropertyChangeListener(Session.LOCALE_PROPERTY, this); initLocaleDependent(); backward.setIcon(new SResourceIcon("icons/ScrollLeft.gif")); backward.setToolTipText("<"); backward.setVerticalTextPosition(TOP); backward.setHorizontalTextPosition(RIGHT); backward.setShowAsFormComponent(false); backward.addActionListener(this); forward.setIcon(new SResourceIcon("icons/ScrollRight.gif")); forward.setToolTipText(">"); forward.setVerticalTextPosition(TOP); forward.setHorizontalTextPosition(RIGHT); forward.setShowAsFormComponent(false); forward.addActionListener(this); add(backward); add(label); add(forward); set(new java.util.GregorianCalendar(getLocale())); }
protected void repaint() { forward.setVisible((year * 100 + month) < maximum); backward.setVisible((year * 100 + month) > minimum); label.setText(" " + monthLabels[month] + " " + year + " "); }
// ------------------------------------------------------------------------------------------------------------------------------------ // 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); } } }
public void setCG(MenuBarCG cg) { super.setCG(cg); }