-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGameOver.java
More file actions
29 lines (22 loc) · 792 Bytes
/
Copy pathGameOver.java
File metadata and controls
29 lines (22 loc) · 792 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import greenfoot.*;
public class GameOver extends World {
private GreenfootSound gameOverSound;
private ButtonMenu buttonMenu;
private ButtonRetry buttonRetry;
public GameOver() {
super(700, 700, 1);
setBackground(new GreenfootImage("GAME OVERR.png"));
gameOverSound = new GreenfootSound("GAME OVER.mp3");
gameOverSound.play();
buttonMenu = new ButtonMenu(gameOverSound);
buttonRetry = new ButtonRetry(gameOverSound);
addObject(buttonMenu, 432, 630);
addObject(buttonRetry, 275, 630);
}
public void stopped() {
if (gameOverSound != null) gameOverSound.stop();
}
public void started() {
if (gameOverSound != null && !gameOverSound.isPlaying()) gameOverSound.play();
}
}