-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscore.java
More file actions
59 lines (54 loc) · 1.03 KB
/
score.java
File metadata and controls
59 lines (54 loc) · 1.03 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
import greenfoot.*;
public class score extends Actor
{
GreenfootImage im;
String t="";
int c,w,h;
Color color=new Color(255,255,255);
public score()
{
w=100;
h=30;
im=new GreenfootImage(w,h);
dibujar();
}
public void titulo(String s)
{
t=s;
dibujar();
}
public void incrementar(int n)
{
c+=n;
dibujar();
}
public void decrementar(int n)
{
c-=n;
dibujar();
}
public void reiniciar(int n)
{
c=n;
dibujar();
}
public int cuenta()
{
return c;
}
public void cambiarColor(int r,int g,int b)
{
color=new Color(r,g,b);
dibujar();
}
public void dibujar()
{
im.clear();
im.setColor(new Color(255,255,255,10));
im.fillRect(0,0,w,h);
im.setFont(new Font("System",true,false,26));
im.setColor(color);
im.drawString(t+" "+c,10,20);
setImage(im);
}
}