1 |
draw_set_circle_precision(12); |
2 |
if (flash < 2) |
3 |
draw_set_color(x_blue); |
4 |
else |
5 |
draw_set_color(c_red); |
6 |
flash -= 1; |
7 |
t = degtorad(dir); |
8 |
r = 30; |
9 |
draw_line_width((x - (cos(t) * r)) + (-sin(t) * r), y + (sin(t) * r) + (-cos(t) * r), x + (-cos(t) * r) + (sin(t) * r), y + (sin(t) * r) + (cos(t) * r), 3); |
10 |
draw_set_color(x_blue); |
11 |
draw_line_width((x - (cos(t) * r)) + (-sin(t) * r), y + (sin(t) * r) + (-cos(t) * r), x + ((-cos(t - 0.2) * r) / 2) + ((sin(t - 0.2) * r) / 2), y + ((sin(t - 0.2) * r) / 2) + ((cos(t - 0.2) * r) / 2), 3); |
12 |
draw_set_color(c_green); |
13 |
draw_circle(x, y, r, 1); |
14 |
if (obj_time.down) |
15 |
idealdir = 90; |
16 |
if (obj_time.up) |
17 |
idealdir = 270; |
18 |
if (obj_time.left) |
19 |
idealdir = 0; |
20 |
if (obj_time.right) |
21 |
idealdir = 180; |
22 |
if (dir != idealdir) |
23 |
{ |
24 |
if (idealdir == 0 && dir > 180) |
25 |
{ |
26 |
neg = 1; |
27 |
dir -= 360; |
28 |
} |
29 |
if (dir >= 0 && dir < 90 && idealdir == 270) |
30 |
{ |
31 |
neg = 2; |
32 |
dir = 360; |
33 |
} |
34 |
if (neg == 0) |
35 |
{ |
36 |
dir %= 360; |
37 |
dif = idealdir - dir; |
38 |
dir += (dif * (2/3)); |
39 |
if (dir < 0) |
40 |
dir += 360; |
41 |
if (abs(dif) < 15) |
42 |
{ |
43 |
dir = idealdir; |
44 |
neg = 0; |
45 |
} |
46 |
} |
47 |
if (neg == 1) |
48 |
{ |
49 |
dir %= 360; |
50 |
dif = abs(idealdir - dir); |
51 |
dir += (dif * (2/3)); |
52 |
if (abs(abs(idealdir) - abs(dir)) < 15) |
53 |
{ |
54 |
dir = idealdir; |
55 |
neg = 0; |
56 |
} |
57 |
} |
58 |
if (neg == 2) |
59 |
{ |
60 |
dif = idealdir - dir; |
61 |
dir += (dif * (2/3)); |
62 |
if (abs(abs(idealdir) - abs(dir)) < 15) |
63 |
{ |
64 |
dir = idealdir; |
65 |
neg = 0; |
66 |
} |
67 |
} |
68 |
} |
69 |
if (old == 1) |
70 |
{ |
71 |
if (dir != idealdir) |
72 |
{ |
73 |
if ((dir - idealdir) == 180) |
74 |
{ |
75 |
if (dir == 0 && idealdir == 180) |
76 |
dir -= 90; |
77 |
if (dir == 90 && idealdir == 270) |
78 |
dir -= 90; |
79 |
if (dir == 180 && idealdir == 0) |
80 |
dir -= 90; |
81 |
if (dir == 270 && idealdir == 90) |
82 |
dir -= 90; |
83 |
} |
84 |
if (dir > 0 && dir < 180 && idealdir == 0) |
85 |
dir -= 60; |
86 |
if (dir > 180 && dir < 360 && idealdir == 180) |
87 |
dir -= 60; |
88 |
if (dir > 90 && dir < 270 && idealdir == 90) |
89 |
dir -= 60; |
90 |
if (dir > 270 || (dir <= 0 && idealdir == 270)) |
91 |
dir -= 60; |
92 |
dir += 30; |
93 |
dir %= 360; |
94 |
if (dir < 0) |
95 |
dir += 360; |
96 |
} |
97 |
} |
98 |
tideal = degtorad(idealdir); |
99 |
col = collision_line((x - (cos(tideal) * r)) + (-sin(tideal) * r), y + (sin(tideal) * r) + (-cos(tideal) * r), x + (-cos(tideal) * r) + (sin(tideal) * r), y + (sin(tideal) * r) + (cos(tideal) * r), obj_blockbullet, false, true); |
100 |
if (col != -4) |
101 |
event_user(4); |
102 |
col2 = collision_rectangle(x - 5, y - 5, x + 5, y + 5, obj_blockbullet, 0, 1); |
103 |
if (col2 != -4) |
104 |
event_user(5); |