-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBullet.java
More file actions
44 lines (33 loc) · 737 Bytes
/
Bullet.java
File metadata and controls
44 lines (33 loc) · 737 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
package nb.test.gamepackagev1;
import java.awt.Color;
import java.awt.Graphics;
import static javax.swing.Spring.height;
public class Bullet {
private int x, y;
private final int width = 3;
private final int height = 8;
private final int speed = 10;
public Bullet(int x, int y) {
this.x = x;
this.y = y;
}
public void draw(Graphics g) {
g.setColor(Color.RED);
g.fillRect(x, y, width, height);
}
public void move() {
y += speed;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getHeight() {
return height;
}
public int getWidth() {
return width;
}
}