-
Notifications
You must be signed in to change notification settings - Fork 0
/
Boss.java
59 lines (51 loc) · 1.04 KB
/
Boss.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
* File: Boss.java
* Author: Luke S. Snyder
* UA ID: 010691128
*/
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.io.Serializable;
@SuppressWarnings("serial")
public class Boss extends Sprite implements Serializable
{
private int health;
public Boss(int x, int y, int velY, int health)
{
setX(x);
setY(y);
setSpan(185);
setVelocityY(velY);
this.health = health;
}
@Override
public void updateImage(Graphics g)
{
g.drawImage(Enemy.getBossImage(), getX(), getY(), 200, 200, null);
Font font = new Font("arial", Font.BOLD, 15);
g.setFont(font);
g.setColor(Color.white);
g.drawString("Boss Health:", 900, 90);
g.drawRect(900, 100, 150, 25);
g.setColor(Color.red);
g.fillRect(900, 100, getHealth(), 25);
}
@Override
public void tick()
{
setY(getY() + getVelocityY());
}
public void shift()
{
setX(getX() + getVelocityX());
}
public void setHealth(int health)
{
this.health = health < 0 ? 0 : health;
}
public int getHealth()
{
return health;
}
}