-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemyBoss.java
More file actions
45 lines (28 loc) · 857 Bytes
/
EnemyBoss.java
File metadata and controls
45 lines (28 loc) · 857 Bytes
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
//Kaushik Siruvuri, Ishaan Sharma, Supreet Mishra
import java.awt.*;
import java.util.Random;
public class EnemyBoss extends GameObject {
private Handler handler;
private Random r = new Random();
public EnemyBoss(int x, int y, ID id, Handler handler) {
super(x, y, id);
this.handler = handler;
velX = 1;
}
public Rectangle getBounds() {
return new Rectangle((int) x, (int) y, 64, 64);
}
public void tick() {
x += velX;
if(handler.numofEnemyBullets() < 16){
int f = r.nextInt(20);
if (f == 1){
handler.addObject(new EnemyBullet((int)x+8,(int)y+8,ID.EnemyBullet,handler));
}
}
}
public void render(Graphics g) {
g.setColor(Color.GREEN);
g.fillRect((int) x, (int) y, 64, 64);
}
}