-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSoundManager.java
More file actions
38 lines (29 loc) · 866 Bytes
/
SoundManager.java
File metadata and controls
38 lines (29 loc) · 866 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
30
31
32
33
34
35
36
37
38
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Manages sound between menu switching. Keeps reference.
*/
public abstract class SoundManager extends World {
public static GreenfootSound soundMenu = new GreenfootSound("mainMenu.mp3");
/**
* Constructor for objects of class SoundManager.
*
*/
public SoundManager(int screenWidth, int screenHeight, int cellSize) {
super(screenWidth, screenHeight, cellSize);
}
public void soundPlaying() {
if (!soundIsPlaying()) {
soundMenu.play();
}
}
public void soundStop() {
soundMenu.stop();
}
public boolean soundIsPlaying() {
if (soundMenu.isPlaying()) {
return true;
} else {
return false;
}
}
}