-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHelpScreen.java
More file actions
52 lines (46 loc) · 1.56 KB
/
Copy pathHelpScreen.java
File metadata and controls
52 lines (46 loc) · 1.56 KB
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
import greenfoot.*;
import java.awt.*;
import java.util.Arrays;
/**
* Write a description of class HelpScreen here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class HelpScreen extends Scene
{
/**
* Act - do whatever the HelpScreen wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
private Button mainMenu;
TypingMaster world;
public HelpScreen(){
mainMenu = new Button("Main Menu");
mainMenu.setIsButton(true);
}
public void act()
{
if(Greenfoot.mouseClicked(null)) {
// Change scene to main menu if it's been clicked on
if(Greenfoot.mouseClicked(mainMenu)) {
world.setScene(world.getMainMenu());
}
}
}
public void enterScene() {
world = (TypingMaster) getWorld();
setLocation(8,4);
int x = this.getX();
int y = this.getY();
GreenfootImage img = new GreenfootImage("This is a typing tutor game where the \n"+
"Player needs to type the words to destroy them \n" +
" and if he misses 3 words the game is over.", 30, Color.white, new Color(0,0,0,0));
img.setFont(new Font("Comic Sans MS", Font.BOLD, 20 ));
setImage(img);
world.addObject(mainMenu,x ,y+2);
}
public void exitScene() {
world.removeObjects(Arrays.asList(new Actor[] {mainMenu}));
}
}