-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHealthBar.java
36 lines (27 loc) · 1022 Bytes
/
HealthBar.java
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
package org.academniadecodigo.dancedance.gameobjects;
import org.academiadecodigo.simplegraphics.pictures.Picture;
import org.academniadecodigo.dancedance.simplegfx.StageSgfx;
/**
* Created by codecadet on 23/10/16.
*/
public class HealthBar {
private Picture health;
private int currentHealth;
private String[] healthBar ;
public void showHealthBar(){
health = new Picture(StageSgfx.PADDING,StageSgfx.PADDING, "resources/art/Health_Bar_Sequence/HEALTH_BAR_0.png");
healthBar = new String[20];
for (int i = 0; i < healthBar.length; i++) {
healthBar[i] = "resources/art/Health_Bar_Sequence/HEALTH_BAR_"+i+".png ";
}
health.draw();
}
public void decreaseHealthBar(){
System.out.println("CURRENT HEALTH: " + currentHealth);
currentHealth = currentHealth + 1;
health.load("resources/art/Health_Bar_Sequence/HEALTH_BAR_"+currentHealth+".png");
}
public void hidehealthBar(){
health.delete();
}
}