4
|
1 function state_update()
|
|
2 {
|
|
3 for(var i = 0; Boolean(active_chara_list.enemy[i]) ; i++)
|
|
4 {
|
|
5 var p = active_chara_list.enemy[i];
|
7
|
6 if(p.flag == true)
|
4
|
7 {
|
|
8 p = p.state(p);
|
|
9 }
|
|
10 }
|
|
11 }
|
7
|
12
|
|
13 noaction = function no_action(p)
|
|
14 {
|
|
15 p.state = noaction;
|
|
16 return p;
|
|
17 }
|
|
18
|
|
19 delete_chara = function delete_character( p )
|
|
20 {
|
|
21 p.state = noaction;
|
|
22 p.flag = false;
|
|
23 return p;
|
|
24 }
|
|
25
|
6
|
26 chara_state0 = function character_state0( p )
|
|
27 {
|
|
28 p.x += p.vx;
|
|
29 p.y += p.vy;
|
|
30 p.state = chara_state0;
|
|
31 return p;
|
|
32 }
|
|
33
|
|
34 chara_state1 = function character_state1( p )
|
|
35 {
|
|
36 p.x -= p.vx;
|
|
37 p.y -= p.vy;
|
|
38 p.state = chara_state1;
|
|
39 return p;
|
|
40 }
|
|
41
|
|
42 chara_state2 = function character_state2( p )
|
|
43 {
|
|
44 p.x -= 0.25;
|
|
45 p.y += p.vy;
|
|
46 p.state = chara_state2;
|
|
47 return p;
|
|
48 }
|
|
49
|
11
|
50 chara_state3 = function character_state3( p )
|
|
51 {
|
|
52 p.x += p.vx;
|
|
53 p.y += p.vy;
|
|
54 if((p.dt1 == 60) ||
|
|
55 (p.dt1 == 90) ||
|
|
56 (p.dt1 == 30))
|
|
57 {
|
|
58 Puttama(0, p.x, p.y);
|
|
59 }
|
|
60 p.dt1++;
|
|
61 p.state = chara_state3;
|
|
62 return p;
|
|
63 }
|
|
64
|
|
65 chara_state4 = function character_state4(p)
|
|
66 {
|
|
67 p.y += p.vy;
|
|
68 p.x += p.vx;
|
|
69 if(p.y < jiki.y && p.y + 16 > jiki.y)
|
|
70 {
|
|
71 p.vy = -2;
|
12
|
72 p.vx = ((jiki.x > p.x ) ? 4 : -4);
|
11
|
73 p.state = chara_state7;
|
|
74 }
|
|
75 else p.state = chara_state4;
|
|
76 return p;
|
|
77 }
|
|
78
|
|
79 chara_state5 = function character_state5(p)
|
|
80 {
|
|
81 p.y += p.vy;
|
|
82 p.x += p.vx;
|
|
83 if(p.y + 96 < jiki.y
|
|
84 && p.y + 128 > jiki.y)
|
|
85 {
|
|
86 p.vy = -2;
|
|
87 p.vx = ((jiki.x > p.x) ? 4 : -4);
|
|
88 p.state = chara_state0;
|
|
89 }
|
|
90 else p.state = chara_state5;
|
|
91 //PutSprite(count, p.x, p.y, p.charano);
|
|
92 return p;
|
|
93 }
|
|
94
|
13
|
95 chara_state6 = function character_state6(p)
|
11
|
96 {
|
|
97 p.y += p.vy;
|
|
98 p.x += p.vx;
|
|
99 if(p.y + 96 < jiki.y
|
|
100 && p.y + 128 > jiki.y)
|
|
101 {
|
|
102 p.vy = 2;
|
|
103 p.vx = ((jiki.x > p.x) ? 4 : -4);
|
|
104 p.state = chara_state0;
|
|
105 }
|
|
106 else p.state = chara_state6;
|
|
107 //PutSprite(count, p.x, p.y, p.charano);
|
|
108 return p;
|
|
109 }
|
|
110
|
|
111 chara_state7 = function character_state7(p)
|
|
112 {
|
|
113 p.x += p.vx;
|
|
114 p.y += p.vy;
|
|
115 if((p.dt1 == 60) || (p.dt1 == 90)
|
|
116 || (p.dt1 == 30))
|
|
117 {
|
|
118 Puttama(1, p.x, p.y);
|
|
119 }
|
|
120 p.dt1++;
|
|
121 p.state = chara_state7;
|
|
122 return p;
|
|
123 }
|
|
124
|
|
125 // stage1 boss patern
|
7
|
126 chara_state8 = function character_state8( p )
|
6
|
127 {
|
11
|
128 if(p.y < 520*d_y)
|
6
|
129 {
|
13
|
130 p.y += p.vy;
|
7
|
131 tekino0 = p;
|
13
|
132 count++;
|
|
133 /*
|
14
|
134 kyeenmyno = p;
|
|
135 DefSpriteEx(p.charano, 16*4, 32*4);
|
|
136 PutSpriteEx(p.charano, (p.x * 4), (p.y * 4), 0.2, 0.2, 1);
|
|
137 */
|
7
|
138 p.dt1 = 512;
|
|
139 p.s = 0.125;
|
|
140 p.state = chara_state8;
|
|
141 return p;
|
6
|
142 }
|
7
|
143 p.state = chara_state9;
|
|
144 return p;
|
|
145 }
|
|
146
|
|
147 chara_state9 = function character_state9( p )
|
|
148 {
|
|
149 if(p.s <= 2)
|
6
|
150 {
|
7
|
151 p.s += 0.05
|
13
|
152 p.y -= 12*d_y;
|
7
|
153 count++;
|
|
154 // DefSpriteEx(54, 16*4, 32*4);
|
|
155 // PutSpriteEx(54, (p.x * 4), (p.y * 4), p.x, p.x, 1);
|
|
156 p.state = chara_state9;
|
|
157 return p;
|
6
|
158 }
|
7
|
159 count++;
|
13
|
160 rinkx = p.x/d_x;
|
|
161 rinky = p.y/d_y;
|
14
|
162 // DefSpriteEx(54, 16,32);
|
|
163 // PutSpriteEx(54, p.x, p.y, p.s, p.s, 1);
|
|
164 // Putenemy(5, rinkx - 16, rinky -16, 1, 0, chara_state10);
|
|
165 // Putenemy(5, rinkx - 16, rinky -16, -1, 0, chara_state10);
|
|
166
|
|
167 PutBoss(4, rinkx - 16*d_x, rinky -16*d_y, 1, 0, chara_state10);
|
|
168 PutBoss(4, rinkx - 16*d_x, rinky -16*d_y, -1, 0, chara_state10);
|
|
169
|
7
|
170 p.state = chara_state11;
|
|
171 p.dt1 = 8192;
|
14
|
172
|
7
|
173 return p;
|
|
174 }
|
|
175
|
|
176 chara_state10 = function character_state10( p )
|
|
177 {
|
|
178 if(p.dt1 < 48)
|
6
|
179 {
|
7
|
180 p.x += p.vx;
|
|
181 p.y += p.vy;
|
|
182 p.dt1++;
|
|
183 p.state = chara_state10;
|
|
184 return p;
|
6
|
185 }
|
7
|
186 rinkf1 = 1;
|
14
|
187 p.dt1 = rinkx * d_x;
|
|
188 p.dt2 = rinky * d_y;
|
7
|
189 p.state = chara_state13;
|
|
190 return p;
|
|
191 }
|
|
192
|
|
193 chara_state11 = function character_state11( p )
|
|
194 {
|
|
195 if(rinkf1 == 0)
|
6
|
196 {
|
7
|
197 count++;
|
|
198 // DefSpriteEx(54, 16, 32);
|
|
199 // PutSpriteEx(54, p.x, p.y, p.s, p.s, 1);
|
14
|
200
|
7
|
201 p.state = chara_state11;
|
|
202 return p;
|
6
|
203 }
|
7
|
204 p.dt1 = 0;
|
|
205 p.dt2 = 0;
|
|
206 p.state = chara_state12;
|
|
207 return p;
|
6
|
208 }
|
|
209
|
7
|
210 chara_state12 = function character_state12( p )
|
|
211 {
|
13
|
212 if(fastebos > 60*60)
|
7
|
213 {
|
13
|
214 // if(p.y > 70+boss[1].h)
|
|
215 if(p.y > (240+32)*d_y)
|
7
|
216 {
|
|
217 p.state = delete_chara;
|
|
218 }
|
14
|
219 p.y += 0.3*d_y;
|
13
|
220 rinky += 0.3*d_y;
|
7
|
221 count++;
|
|
222 // DefSpriteEx(54, 16, 32);
|
|
223 // PutSpriteEx(54, p.x, p.y, 2, 2, 1);
|
|
224 p.state = chara_state12;
|
|
225 return p;
|
|
226 }
|
|
227 if(p.dt1 <= 60)
|
|
228 {
|
13
|
229 if(jiki.x + 15*d_x -rinkx < -5*d_x)
|
7
|
230 {
|
13
|
231 p.vx = -0.3 * d_x;
|
7
|
232 }
|
13
|
233 else if(jiki.x + 15*d_x - rinkx > 5*d_x)
|
7
|
234 {
|
13
|
235 p.vx = +0.8 * d_x;
|
7
|
236 }
|
|
237 else p.vx = 0;
|
|
238 rinkx = p.x;
|
|
239 rinky = p.y;
|
|
240 }
|
|
241 if((p.dt1 > 60) && (p.dt1 <= 70))
|
|
242 {
|
|
243 if(p.dt1 % 2 == 1)
|
|
244 {
|
14
|
245 Puttama(0, rinkx/d_x - 16 , rinky/d_y);
|
|
246 Puttama(0, rinkx/d_x, rinky/d_y);
|
|
247 Puttama(0, rinkx/d_x + 16, rinky/d_y);
|
7
|
248 }
|
|
249 }
|
|
250 if((p.dt1 > 180) && (p.dt1 <= 240))
|
|
251 {
|
|
252 if(p.dt1 % 2 == 1)
|
|
253 {
|
|
254 rinkf2 = 1;
|
14
|
255 Puttama(2, rinkx/d_x - 16, p.y/d_y -32);
|
|
256 Puttama(3, rinkx/d_x + 32 - 16, p.y/d_y - 32);
|
7
|
257 }
|
|
258 else
|
|
259 {
|
|
260 rinkf2 = 2;
|
|
261 }
|
|
262 }
|
|
263 if(p.df1 > 240)
|
|
264 {
|
|
265 rinkf2 = 2;
|
|
266 }
|
|
267 if((p.dt1 > 240) && (p.dt1 <= 400))
|
|
268 {
|
|
269 count++;
|
|
270 // PutSprite(count, rinkx - 16, rinky + 32, 58 + p.dt1 %4)
|
|
271 }
|
|
272 if((p.dt1 > 300) && (p.dt1 <= 400))
|
|
273 {
|
|
274 rinkf2 = 3;
|
13
|
275 if(jiki.x + 15*d_x - rinkx < -5*d_x)
|
7
|
276 {
|
13
|
277 p.vx = -1 * d_x;
|
7
|
278 }
|
13
|
279 else if(jiki.x + 15*d_x - rinkx > 5*d_x)
|
7
|
280 {
|
13
|
281 p.vx = +1 * d_x;
|
7
|
282 }
|
|
283 else p.vx = 0;
|
|
284 p.x += p.vx;
|
|
285 rinkx = p.x;
|
|
286 rinky = p.y;
|
14
|
287 Puttama(4, rinkx/d_x - 8, rinky/d_y + 16);
|
7
|
288 }
|
|
289 if((p.dt1 > 400) && (p.dt1 <= 500))
|
|
290 {
|
|
291 rinkf2 = 4;
|
13
|
292 if(jiki.x + 15*d_x - rinkx > 5*d_x)
|
7
|
293 {
|
14
|
294 p.vx = -1*d_x;
|
7
|
295 }
|
13
|
296 else if(jiki.x + 15*d_x - rinkx > 5*d_x)
|
7
|
297 {
|
13
|
298 p.vx = +1*d_x;
|
7
|
299 }
|
|
300 else p.vx = 0;
|
|
301 p.x += p.vx;
|
|
302 rinkx = p.x;
|
|
303 rinky = p.y;
|
|
304 }
|
|
305 if(p.dt1 > 500)
|
|
306 {
|
|
307 rinkf2 = 5;
|
13
|
308 if(jiki.x + 15*d_x - rinkx < -5*d_x)
|
7
|
309 {
|
13
|
310 p.vx = -1*d_x;
|
7
|
311 }
|
13
|
312 else if(jiki.x + 15*d_x - rinkx > 5*d_x)
|
7
|
313 {
|
13
|
314 p.vx = +1*d_x;
|
7
|
315 }
|
|
316 else p.vx = 0;
|
|
317 p.x += p.vx;
|
|
318 rinkx = p.x;
|
|
319 rinky = p.y;
|
|
320 }
|
|
321 if(p.dt1 > 600)
|
|
322 {
|
|
323 rinkf2 = 0;
|
|
324 p.dt1 = 0;
|
|
325 }
|
|
326 fastebos++;
|
|
327 p.dt1++;
|
|
328 count++;
|
|
329 // DefSpriteEx(54, 16, 32);
|
|
330 // PutSpriteEx(54, p.x, p.y, 2, 2, 1);
|
|
331 p.state = chara_state12;
|
|
332 return p;
|
14
|
333
|
7
|
334 }
|
|
335
|
|
336 chara_state13 = function character_state13(p)
|
|
337 {
|
|
338 if(tekino0.flag == false)
|
|
339 {
|
13
|
340 Bom(p.x, p.y);
|
7
|
341 p.flag = false;
|
|
342 p.state = delete_chara;
|
|
343 p.collision = noaction;
|
|
344 return p;
|
|
345 }
|
13
|
346 p.x += rinkx*d_x - p.dt1*d_x;
|
|
347 p.y += rinky*d_y -p.dt2*d_y;
|
7
|
348 p.dt1 = rinkx;
|
|
349 p.dt2 = rinky;
|
|
350 if(rinkf2 == 1)
|
|
351 {
|
13
|
352 if(p.x > rinkx * d_x)
|
7
|
353 {
|
14
|
354 Puttama(2, p.x/d_x + 32, p.y/d_y);
|
7
|
355 }
|
|
356 }
|
|
357 if(rinkf2 == 4)
|
|
358 {
|
|
359 count++;
|
|
360 // PutSprite(count, p.x, p.y + 56, 58+filpcount % 4);
|
14
|
361 // PutBoss(count, p.x, p.y + 56, 58+filpcount % 4);
|
|
362 // PutBoss(2, rinkx/d_x - 16, rinky/d_y -16, 1, 0, chara_state10);
|
7
|
363 }
|
|
364 if(rinkf2 == 5)
|
|
365 {
|
13
|
366 if(p.x > rinkx*d_x)
|
7
|
367 {
|
14
|
368 Puttama(5, p.x/d_x + 8 , p.y/d_y + 24);
|
7
|
369 }
|
13
|
370 if(p.x < rinkx*d_x)
|
7
|
371 {
|
14
|
372 Puttama(5, p.x/d_x + 8, p.y/d_y + 24);
|
7
|
373 }
|
|
374 }
|
|
375 return p;
|
|
376 }
|
13
|
377
|
|
378
|
16
|
379 chara_state20 = function character_state20(p)
|
13
|
380 {
|
|
381 p.x += p.vx;
|
|
382 p.y += p.vy;
|
|
383 p.vx -= 0.5*d_x;
|
|
384 p.vy += 0.4*d_y;
|
|
385 return p;
|
|
386 }
|
|
387
|
14
|
388 chara_state21 = function character_state21(p)
|
13
|
389 {
|
|
390 p.x += p.vx;
|
|
391 p.y += p.vy;
|
|
392 p.vx += 0.5*d_x;
|
|
393 p.vy += 0.4*d_y;
|
|
394 return p;
|
14
|
395 }
|
|
396
|
|
397 chara_state22 = function character_state22(p)
|
|
398 {
|
|
399 sf = Math.random() % 4;
|
16
|
400 sf = parseInt(sf);
|
14
|
401 if((sf == 0) || (sf == 1))
|
|
402 {
|
16
|
403 p.x = -35*d_x;
|
|
404 p.y = Math.random() % (120 - 35)*d_y;
|
|
405 p.vx = (Math.random() % 4 + 1)*d_x;
|
|
406 p.vy = ( Math.random() % 3 + 1 )*d_y;
|
14
|
407 p.state = chara_state23;
|
|
408 }
|
|
409 if((sf == 2))
|
|
410 {
|
16
|
411 p.x = ( Math.random() % 290 )*d_x;
|
|
412 p.y = -30 * d_y;
|
|
413 p.vx = ( Math.random() % 3 - 1 )*d_x;
|
|
414 p.vy = ( (Math.random() % 4 + 1) )*d_y;
|
14
|
415 p.state = chara_state23;
|
|
416 }
|
|
417 if(sf == 3)
|
|
418 {
|
16
|
419 p.x = ( 320 )*d_x;
|
|
420 p.y = ( Math.random() % (120 - 35) )*d_y;
|
|
421 p.vx = ( (Math.random() % 4 + 1) * -1 ) *d_x;
|
|
422 p.vy = ( Math.random() % 3 -1 ) *d_y;
|
14
|
423 p.state = chara_state23;
|
|
424 }
|
|
425 return p;
|
|
426 }
|
|
427
|
16
|
428 chara_state23 = function character_state32(p)
|
|
429 {
|
|
430 /*本当はこの 2 行だけ
|
|
431 p=asteroid(p);
|
|
432 return p;
|
|
433 */
|
14
|
434
|
16
|
435 //
|
|
436 p.x += p.vx;
|
|
437 p.y += p.vy;
|
|
438 p.state = chara_state23;
|
|
439 return p;
|
|
440 }
|
14
|
441
|
|
442 chara_state400 = function character_state400(p)
|
|
443 {
|
|
444 p.vy++;
|
|
445 p.y += p.vy / 4;
|
|
446 p.state = chara_state400;
|
|
447 return p;
|
|
448 }
|
|
449
|
|
450 chara_state401 = function character_state401(p)
|
|
451 {
|
|
452 {
|
|
453 p.vx++;
|
|
454 p.x += p.vx / 8;
|
|
455 if (p.x > (jiki.x - 32))
|
|
456 {
|
|
457 p.vy--;
|
|
458 }
|
|
459 p.y += p.vy / 8;
|
|
460 if (p.dt1 % 50 == 37)
|
|
461 {
|
|
462 Puttama(1, p.x + 8, p.y + 24);
|
|
463 }
|
|
464 p.dt1++;
|
|
465 return p;
|
|
466 }
|
|
467 }
|
|
468
|
|
469 chara_state402 = function character_state402(p)
|
|
470 {
|
|
471 p.vx--;
|
|
472 p.x += p.vx / 8;
|
|
473 if(p.x < (jiki.x + 32 * d_x))
|
|
474 {
|
|
475 p.vy--;
|
|
476 }
|
|
477 p.y += p.vy / 8;
|
|
478 if(p.dt1 % 50 == 37)
|
|
479 {
|
|
480 Puttama(1, p.x + 8, p.y + 42);
|
|
481 }
|
|
482 p.dt1++;
|
|
483 return p;
|
13
|
484 } |