- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFaithBar.java
More file actions
Latest commit
62 lines (57 loc) · 1.28 KB
/
Copy pathFaithBar.java
File metadata and controls
62 lines (57 loc) · 1.28 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
importgreenfoot.*;
/**
* Write a description of class FaithBar here.
*
* @author (your name)
* @version (a version number or a date)
*/
publicclassFaithBarextendsActor
{
GreenfootImagebar;
publicFaithBar(Characterplayer)
{
super();
setFaithImage(player);
bar = newGreenfootImage(getFaithPath(player));
bar.scale(150, 40);
setImage(bar);
}
/**
* Adjust the faithbar image for the player.
*/
publicvoidsetFaithImage(Characterplayer)
{
bar = newGreenfootImage(getFaithPath(player));
bar.scale(150, 40);
setImage(bar);
}
/**
* Get path for new faith bar image.
*/
publicStringgetFaithPath(Characterplayer)
{
intfaith = player.getFaithPercent();
intbarNum = -1;
inttemp;
StringnewPath = "";
temp = faith % 4;
if (temp == 0)
{
barNum = faith;
}
elseif (temp == 1)
{
barNum = faith + 3;
}
elseif (temp == 2)
{
barNum = faith + 2;
}
else
{
barNum = faith + 1;
}
newPath = "images/mpbar/mp_" + barNum + "%.png";
returnnewPath;
}
}