-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHUD.java
More file actions
49 lines (40 loc) · 1.08 KB
/
HUD.java
File metadata and controls
49 lines (40 loc) · 1.08 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
package com.tutorial.main;
import java.awt.*;
/**
* Created by narhwal on 6/10/2016.
*/
public class HUD {
public static int HEALTH = 100;
private int score = 0;
private int level = 1;
private int greenValue = 255;
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public int getLevel() {
return level;
}
public void setLevel(int level) {
this.level = level;
}
public void tick() {
}
public void render(Graphics g) {
/* g.setColor(Color.gray);
g.fillRect(15, 15, 200, 32);
g.setColor(new Color(75, greenValue, 0));
g.fillRect(15, 15, HEALTH * 2, 32);
g.setColor(Color.white);
g.drawRect(15, 15, 200, 32);
*/
g.setColor(Color.gray);
g.fillRect(15, Game.HEIGHT - 50, 150, 16);
g.fillRect(170, Game.HEIGHT - 50, 100, 16);
g.setColor(Color.white);
g.drawString("Score:" + score, 18, Game.HEIGHT - 36);
g.drawString("Level:" + level, 175, Game.HEIGHT - 36);
}
}