-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBullet.pde
71 lines (57 loc) · 2.21 KB
/
Bullet.pde
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
class Bullet {
float xBullet = 100;
float yBullet;
int fireOrient;
boolean fireUpOnce;
boolean fireDownOnce;
boolean fireMidOnce;
Bullet(float tempY) {
yBullet = tempY;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - move
void move() {
xBullet += 60;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - updateDirection
void updateDirection(boolean tempUp, boolean tempDown) {
if (tempUp)
fireUpOnce = true;
else if (tempDown)
fireDownOnce = true;
else
fireMidOnce = true;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - display
void display() {
strokeWeight(8);
stroke(#ff0000);
if (fireUpOnce) {
line(xBullet-100, yBullet-35, xBullet, yBullet-45);
line(xBullet-90, yBullet-15, xBullet+10, yBullet-25);
line(xBullet-100, yBullet+5, xBullet, yBullet-5);
line(xBullet-90, yBullet+25, xBullet+10, yBullet+15);
yBullet -= 10;
}
if (fireDownOnce) {
line(xBullet-100, yBullet-35, xBullet, yBullet-25);
line(xBullet-90, yBullet-45, xBullet+10, yBullet-35);
line(xBullet-100, yBullet+35, xBullet, yBullet+45);
line(xBullet-90, yBullet+25, xBullet+10, yBullet+35);
yBullet += 10;
}
if (fireMidOnce) {
line(xBullet-100, yBullet-35, xBullet, yBullet-35);
line(xBullet-90, yBullet-45, xBullet+10, yBullet-45);
line(xBullet-100, yBullet+35, xBullet, yBullet+35);
line(xBullet-90, yBullet+25, xBullet+10, yBullet+25);
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - PositionX
float PositionX() {
return xBullet;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - PositionY
float PositionY() {
return yBullet;
}
}