-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBullet.java
More file actions
142 lines (119 loc) · 2.28 KB
/
Copy pathBullet.java
File metadata and controls
142 lines (119 loc) · 2.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
import java.lang.*;
/**
Class to track bullets
@author Kush Banker
@version ur mom
*/
class Bullet
{
protected int bulletX;
protected int bulletY;
protected int bulletDiam;
protected int bulletSpeed;
protected int bulletDamage;
protected long timeShot;
// Constructor
public Bullet(int x, int y, int d, int s, int damage)
{
bulletX = x;
bulletY = y;
bulletDiam = d;
bulletSpeed = s;
bulletDamage = damage;
timeShot = System.currentTimeMillis();
}
public void updateBullet()
{
bulletY += bulletSpeed;
}
public void changeX(int change)
{
bulletX += change;
}
public void changeY(int change)
{
bulletY += change;
}
public int getX()
{
return bulletX;
}
public int getY()
{
return bulletY;
}
public long getTimeShot()
{
return timeShot;
}
public void setX(int x)
{
bulletX = x;
}
public void setY(int y)
{
bulletY = y;
}
public int getDiam()
{
return bulletDiam;
}
public int getSpeed()
{
return bulletSpeed;
}
public int getDamage()
{
return bulletDamage;
}
}
/**
Subclass of Bullets for use by Enemies
@author Kush Banker
@version 15.11.19
*/
class EnemyBullet extends Bullet
{
public static final int ENEMY_BULLET_SIZE = 10;
public static final int ENEMY_BULLET_SPEED = 20;
public static final int DAMAGE = 1;
// Constructor with set size and speed
public EnemyBullet(int x, int y)
{
super(x, y, ENEMY_BULLET_SIZE, ENEMY_BULLET_SPEED, DAMAGE);
}
// Constructor with size and speed params
public EnemyBullet(int x, int y, int d, int s, int damage)
{
super(x, y, d, s, damage);
}
}
/**
Subclass of Bullets for use by Enemies
@author Kush Banker and Jack Basinet
@version 15.11.19
*/
class EnemyMissile extends EnemyBullet
{
public static final int MISSILE_SIZE = 20;
public static final int MISSILE_SPEED = 10;
public static final int DAMAGE = 3;
// Constructor
public EnemyMissile(int x, int y)
{
super(x, y, MISSILE_SIZE, MISSILE_SPEED, DAMAGE);
}
}
/**
Subclass of Bullets for use by the player
@author Kush Banker
@version 15.11.19
*/
class PlayerBullet extends Bullet
{
// Constructor
public PlayerBullet(int x, int y, int size, int speed, int damage)
{
super(x, y, size, speed, damage);
}
}