-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainMenu.java
56 lines (47 loc) · 1.4 KB
/
MainMenu.java
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class MainMenu here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class MainMenu extends World
{
static GreenfootSound music = new GreenfootSound("Marimba Boy.wav");
/**
* Constructor for objects of class MainMenu.
*
*/
public MainMenu()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(400, 640, 1);
if (PlayScreen.isWebMode == false)
{
GreenfootImage text = new GreenfootImage(" Connection could not be established ", 15, Color.GRAY, new Color(0,0,0,100));
getBackground().drawImage(text, 180, 620);
}
prepare();
}
public void started()
{
music.playLoop();
}
public void stopped()
{
music.stop();
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
private void prepare()
{
Button playButton = new Button("PlayButton");
addObject(playButton,200,440);
Button volumeButton = new Button("VolumeButton");
addObject(volumeButton,50,600);
Button infoButton = new Button("InfoButton");
addObject(infoButton,45,50);
}
}