-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBossShot.java
More file actions
38 lines (35 loc) · 771 Bytes
/
BossShot.java
File metadata and controls
38 lines (35 loc) · 771 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
package shooting;
import javax.swing.ImageIcon;
public class BossShot extends HyperShot {
private double speed_x;
private double speed_y;
private static int MOVE_INTERVAL=25;
private int count=0;
public BossShot(MainPanel panel) {
super(panel);
}
public void move() {
if(isInstorage()) {
return;
}
if(count<MOVE_INTERVAL) {
count+=1;
}else {
speed_x=-speed_x;
speed_y=-speed_y;
count=0;
}
x+=speed_x;
y+=speed_y;
}
@Override
public void setSpeed(int i) {
speed_x=4*Math.cos((i*Math.PI)/2);
speed_y=4*Math.sin((i*Math.PI)/2);
}
protected void loadImage() {
ImageIcon icon=new ImageIcon(getClass().getResource("image/shot1.gif"));
image=icon.getImage();
super.loadImage();
}
}