-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInfoLayer.java
More file actions
executable file
·74 lines (53 loc) · 1.73 KB
/
Copy pathInfoLayer.java
File metadata and controls
executable file
·74 lines (53 loc) · 1.73 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
import java.awt.Color;
import java.awt.Font;
/**
* Write a description of class InfoLayer here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class InfoLayer extends Actor
{
GreenfootImage image = null;
public static int landings = 0;
public static int bestrun = 0;
public static int crashes = 0;
Color mycolor = new Color(100,100,200);
Color myOrange = new Color(0xFF,0x48,0x00);
Color myGold = new Color(0xFF,0xCC,0x00);
private Font myFont = new Font("TimesRoman", Font.BOLD, 17);
public InfoLayer()
{
image = new GreenfootImage(640,480);
image.setFont(myFont);
//image.setColor(new Color(10,10,255));
//image.fill();
//image.setTransparency(15);
setImage(image);
landings = 0;
bestrun = 0;
crashes = 0;
}
/**
* Act - do whatever the InfoLayer wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
image.clear();
String Landings = "Landings : " + landings;
if (bestrun < landings)
{
bestrun = landings;
}
String BestRun = "Most Landings : " + bestrun;
String Crashes = "Crashes : " + crashes;
image.setColor(mycolor);
image.drawString(Landings,7,20);
image.setColor(myOrange);
image.drawString(Crashes,230,20);
image.setColor(myGold);
image.drawString(BestRun,440,20);
}
}