-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainMenu.java
45 lines (41 loc) · 1.25 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
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
{
/**
* Constructor for objects of class MainMenu.
*
*/
public MainMenu()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(1280, 720, 1, false);
prepare();
}
/**
* Prepare the world for the start of the program.
* That is: create the initial objects and add them to the world.
*/
private void prepare()
{
Title title = new Title();
addObject(title,getWidth()/2,185);
StartGame startgame = new StartGame();
addObject(startgame,getWidth()/2,424);
ExitGame exitgame = new ExitGame();
addObject(exitgame,getWidth()/2,578);
title.setLocation(getWidth()/2,175);
startgame.setLocation(getWidth()/2,407);
exitgame.setLocation(getWidth()/2,579);
HowToPlay how = new HowToPlay();
addObject(how,(getWidth()*(3/4)),185);
how.setLocation(208,653);
Credits credits = new Credits();
addObject(credits,1109,651);
}
}