1 |
if (instance_exists(obj_mainchara)) |
2 |
{ |
3 |
if (loc_check == 0) |
4 |
{ |
5 |
if (room == room_forest_starwalker) |
6 |
{ |
7 |
if (obj_mainchara.x >= (room_width / 2)) |
8 |
x = 2200; |
9 |
} |
10 |
loc_check = 1; |
11 |
} |
12 |
for (i = 5; i > 0; i -= 1) |
13 |
{ |
14 |
char_xcheck[i] = char_xcheck[i - 1]; |
15 |
char_ycheck[i] = char_ycheck[i - 1]; |
16 |
} |
17 |
char_xcheck[0] = obj_mainchara.x; |
18 |
char_ycheck[0] = obj_mainchara.y; |
19 |
xcheck_average = ((obj_mainchara.x - char_xcheck[1]) + (obj_mainchara.x - char_xcheck[2]) + (obj_mainchara.x - char_xcheck[3])) / 3; |
20 |
if (xcheck_average >= 2 && x >= obj_mainchara.x) |
21 |
xcheck_average = 0; |
22 |
if (xcheck_average <= -2 && x <= obj_mainchara.x) |
23 |
xcheck_average = 0; |
24 |
ycheck_average = ((obj_mainchara.y - char_ycheck[1]) + (obj_mainchara.y - char_ycheck[2]) + (obj_mainchara.y - char_ycheck[3])) / 3; |
25 |
} |
26 |
if (keyboard_check_pressed(vk_backspace) && beatcon == 89898) |
27 |
{ |
28 |
visible = 0; |
29 |
beatcon = 1; |
30 |
beattimer = 0; |
31 |
with (obj_mainchara) |
32 |
battlemode = 0; |
33 |
dead = instance_create(x - 92, y - 74, obj_starwalker_battle); |
34 |
with (dead) |
35 |
{ |
36 |
walkcon = 1; |
37 |
walktimer = 0; |
38 |
} |
39 |
with (shadow) |
40 |
instance_destroy(); |
41 |
} |
42 |
targetx = obj_mainchara.x + (obj_mainchara.sprite_width / 2); |
43 |
targety = obj_mainchara.y + (obj_mainchara.sprite_height / 2); |
44 |
if (mazemode == 0) |
45 |
{ |
46 |
if (abs(targetx - x) <= 200 && introcon == 0) |
47 |
{ |
48 |
introcon = 1; |
49 |
with (obj_mainchara) |
50 |
battlemode = 1; |
51 |
} |
52 |
if (introcon == 1) |
53 |
{ |
54 |
attackcon = 0; |
55 |
vspeed = -2; |
56 |
introcon = 2; |
57 |
} |
58 |
if (introcon == 2) |
59 |
{ |
60 |
attacktimer = 0; |
61 |
introtimer += 1; |
62 |
if (introtimer >= 20) |
63 |
{ |
64 |
introcon = 3; |
65 |
vspeed = 0; |
66 |
} |
67 |
} |
68 |
if (introcon == 3) |
69 |
{ |
70 |
friction = 0.5; |
71 |
if (targetx < x) |
72 |
{ |
73 |
if (x <= (targetx + 150)) |
74 |
hspeed += 1; |
75 |
if (x >= (targetx + 250)) |
76 |
hspeed -= 1; |
77 |
} |
78 |
if (targetx > x) |
79 |
{ |
80 |
if (x >= (targetx - 150)) |
81 |
hspeed -= 1; |
82 |
if (x <= (targetx - 250)) |
83 |
hspeed += 1; |
84 |
} |
85 |
} |
86 |
} |
87 |
if (mazemode == 1) |
88 |
{ |
89 |
if (targety <= y && introcon == 0) |
90 |
{ |
91 |
introcon = 1; |
92 |
with (obj_mainchara) |
93 |
battlemode = 1; |
94 |
} |
95 |
if (introcon == 1) |
96 |
{ |
97 |
attackcon = 0; |
98 |
vspeed = -8; |
99 |
introcon = 2; |
100 |
} |
101 |
if (introcon == 2) |
102 |
{ |
103 |
attacktimer = 0; |
104 |
introtimer += 1; |
105 |
if (introtimer >= 5) |
106 |
{ |
107 |
introcon = 3; |
108 |
vspeed = 0; |
109 |
attacktimer = 36; |
110 |
} |
111 |
} |
112 |
if (introcon == 3) |
113 |
{ |
114 |
friction = 0.7; |
115 |
if (targety < (y - 20)) |
116 |
vspeed -= 1.5; |
117 |
if (targety > (y + 20)) |
118 |
vspeed += 1.5; |
119 |
} |
120 |
} |
121 |
if (beatcon == 0) |
122 |
{ |
123 |
if (attackcon >= 0) |
124 |
{ |
125 |
if (obj_mainchara.battlemode == 1) |
126 |
attacktimer += 1; |
127 |
} |
128 |
if (attackcon == 0) |
129 |
{ |
130 |
wingtimer += 1; |
131 |
if (wingtimer >= 0) |
132 |
{ |
133 |
snd_play(snd_wing); |
134 |
wingtimer = -16; |
135 |
} |
136 |
} |
137 |
if (attacktimer >= 42 && attackcon == 0) |
138 |
{ |
139 |
wingtimer = 0; |
140 |
shakefactor = 6; |
141 |
attackcon = 1; |
142 |
if (shot == 1) |
143 |
{ |
144 |
for (i = 0; i < 3; i += 1) |
145 |
{ |
146 |
with (starbullet[i]) |
147 |
instance_destroy(); |
148 |
} |
149 |
} |
150 |
} |
151 |
if (attacktimer >= 60 && attackcon == 1) |
152 |
{ |
153 |
snd_play(snd_crow); |
154 |
attackcon = 2; |
155 |
shot = 1; |
156 |
for (i = 0; i < 3; i += 1) |
157 |
{ |
158 |
starbullet[i] = instance_create(x + (17 * xmake), y + 42, obj_overworldbulletparent); |
159 |
starbullet[i].sprite_index = spr_starbullet_test; |
160 |
starbullet[i].image_xscale = 2; |
161 |
starbullet[i].image_yscale = 2; |
162 |
starbullet[i].damage = 15; |
163 |
starbullet[i].active = 1; |
164 |
starbullet[i].target = 3; |
165 |
starbullet[i].speed = 10; |
166 |
starbullet[i].friction = -0.2; |
167 |
starbullet[i].direction = (point_direction(x + (17 * xmake), y + 42, obj_mainchara.x + (xcheck_average * 10) + (obj_mainchara.sprite_width / 2), obj_mainchara.y + (obj_mainchara.sprite_height / 2)) - 17) + (17 * i); |
168 |
starbullet[i].depth = 1000; |
169 |
} |
170 |
} |
171 |
if (attacktimer >= 80) |
172 |
{ |
173 |
siner = 0; |
174 |
wing_index = 0; |
175 |
attackcon = 0; |
176 |
attacktimer = 0; |
177 |
if (mazemode == 1) |
178 |
attacktimer = 38; |
179 |
} |
180 |
} |
181 |
if (i_ex(shadow)) |
182 |
{ |
183 |
if (attackcon == -1) |
184 |
shadow.visible = 0; |
185 |
else |
186 |
shadow.visible = 1; |
187 |
if (mazemode == 1) |
188 |
shadow.visible = 0; |
189 |
shadow.x = x; |
190 |
shadow.y = shadowy; |
191 |
shadow.sprite_index = spr_starwalker_wings; |
192 |
shadow.image_index = wing_index; |
193 |
if (attackcon == 1) |
194 |
{ |
195 |
shadow.sprite_index = spr_starwalker_attack; |
196 |
shadow.image_index = 0; |
197 |
shadow.image_xscale = xmake; |
198 |
} |
199 |
if (attackcon == 2) |
200 |
{ |
201 |
shadow.sprite_index = spr_starwalker_attack; |
202 |
shadow.image_index = 1; |
203 |
shadow.image_xscale = xmake; |
204 |
} |
205 |
} |
206 |
if (beatcon == 1) |
207 |
{ |
208 |
with (obj_mainchara) |
209 |
battlemode = 0; |
210 |
if (global.interact == 0) |
211 |
{ |
212 |
global.interact = 1; |
213 |
beattimer = 0; |
214 |
beatcon = 2; |
215 |
} |
216 |
} |
217 |
if (beatcon == 2) |
218 |
{ |
219 |
beattimer += 1; |
220 |
if (dead.x >= (__view_get(e__VW.XView, 0) + __view_get(e__VW.WView, 0)) && global.interact != 0) |
221 |
{ |
222 |
with (dead) |
223 |
instance_destroy(); |
224 |
global.interact = 0; |
225 |
beatcon = 3; |
226 |
instance_destroy(); |
227 |
} |
228 |
} |
229 |
|
230 |
enum e__VW |
231 |
{ |
232 |
XView, |
233 |
YView, |
234 |
WView, |
235 |
HView, |
236 |
Angle, |
237 |
HBorder, |
238 |
VBorder, |
239 |
HSpeed, |
240 |
VSpeed, |
241 |
Object, |
242 |
Visible, |
243 |
XPort, |
244 |
YPort, |
245 |
WPort, |
246 |
HPort, |
247 |
Camera, |
248 |
SurfaceID |
249 |
} |