-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHUD.java
More file actions
55 lines (37 loc) · 1.02 KB
/
HUD.java
File metadata and controls
55 lines (37 loc) · 1.02 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
//Kaushik Siruvuri, Ishaan Sharma, Supreet Mishra
import java.awt.*;
public class HUD {
public static float HEALTH = 3;
public static int bossHEALTH = 10;
private int score = 0;
public int level = 1;
public void tick() {
score++;
}
public void render(Graphics g) {
g.setColor(Color.red);
g.fillRect(15, 15, 32, 32);
g.fillRect(60, 15, 32, 32);
g.fillRect(105, 15, 32, 32);
g.setColor(Color.black);
g.fillRect(15, 15, (int)((3-HEALTH)*40), 32);
g.setColor(Color.white);
g.drawRect(15, 15, 32, 32);
g.drawRect(60, 15, 32, 32);
g.drawRect(105, 15, 32, 32);
g.drawString("Score:" + score, 10, 64);
g.drawString("Level:" + level, 10, 80);
}
public void setScore(int score) {
this.score = score;
}
public int getScore() {
return score;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
}