-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFighter.java
More file actions
42 lines (36 loc) · 1 KB
/
Fighter.java
File metadata and controls
42 lines (36 loc) · 1 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
import java.io.*;
import javax.imageio.ImageIO;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
public class Fighter extends Ship {
protected Fighter() {}
public Fighter(int X, int Y, int sID, double mv) {
// pass maxVelocity to SpaceObj
super(mv);
shipID = sID;
mass = 4;
weapons.add(BulletGun.newDefaultWeapon(this));
maxStructInteg = 50;
structInteg = maxStructInteg;
angle = Math.random()*2*Math.PI - Math.PI;
x = X;
y = Y;
dx = 0;
dy = 0;
baseAccelRate = .1;
turnRate = Math.PI / 700;
isAccel = 1;
if (Math.random() > .5)
turningRight = true;
else
turningLeft = true;
firing = true;
origObjImg = null;
try {
origObjImg = ImageIO.read(getClass().getResource("fighter.png"));
} catch (IOException e) {
e.printStackTrace();
}
diam = origObjImg.getWidth();
}
}