comparison webGL/dandy/resources/Character_state.js @ 14:a2b31fe50d9d

upload
author NOBUYASU Oshiro
date Sat, 17 Jul 2010 08:11:20 +0900
parents 4684e849866c
children 527eac9a7d0b
comparison
equal deleted inserted replaced
13:4684e849866c 14:a2b31fe50d9d
129 { 129 {
130 p.y += p.vy; 130 p.y += p.vy;
131 tekino0 = p; 131 tekino0 = p;
132 count++; 132 count++;
133 /* 133 /*
134 kyeenmyno = p; 134 kyeenmyno = p;
135 DefSpriteEx(p.charano, 16*4, 32*4); 135 DefSpriteEx(p.charano, 16*4, 32*4);
136 PutSpriteEx(p.charano, (p.x * 4), (p.y * 4), 0.2, 0.2, 1); 136 PutSpriteEx(p.charano, (p.x * 4), (p.y * 4), 0.2, 0.2, 1);
137 */ 137 */
138
139 p.dt1 = 512; 138 p.dt1 = 512;
140 p.s = 0.125; 139 p.s = 0.125;
141 p.state = chara_state8; 140 p.state = chara_state8;
142 return p; 141 return p;
143 } 142 }
158 return p; 157 return p;
159 } 158 }
160 count++; 159 count++;
161 rinkx = p.x/d_x; 160 rinkx = p.x/d_x;
162 rinky = p.y/d_y; 161 rinky = p.y/d_y;
163 // DefSpriteEx(54, 16,32); 162 // DefSpriteEx(54, 16,32);
164 // PutSpriteEx(54, p.x, p.y, p.s, p.s, 1); 163 // PutSpriteEx(54, p.x, p.y, p.s, p.s, 1);
165 // Putenemy(5, rinkx - 16, rinky -16, 1, 0, chara_state10); 164 // Putenemy(5, rinkx - 16, rinky -16, 1, 0, chara_state10);
166 // Putenemy(5, rinkx - 16, rinky -16, -1, 0, chara_state10); 165 // Putenemy(5, rinkx - 16, rinky -16, -1, 0, chara_state10);
167 166
168 PutBoss(2, rinkx - 16*d_x, rinky -16*d_y, 1, 0, chara_state10); 167 PutBoss(4, rinkx - 16*d_x, rinky -16*d_y, 1, 0, chara_state10);
169 PutBoss(2, 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);
170 169
171 p.state = chara_state11; 170 p.state = chara_state11;
172 p.dt1 = 8192; 171 p.dt1 = 8192;
173 172
174 return p; 173 return p;
175 } 174 }
176 175
177 chara_state10 = function character_state10( p ) 176 chara_state10 = function character_state10( p )
178 { 177 {
183 p.dt1++; 182 p.dt1++;
184 p.state = chara_state10; 183 p.state = chara_state10;
185 return p; 184 return p;
186 } 185 }
187 rinkf1 = 1; 186 rinkf1 = 1;
188 p.dt1 = rinkx; 187 p.dt1 = rinkx * d_x;
189 p.dt2 = rinky; 188 p.dt2 = rinky * d_y;
190 p.state = chara_state13; 189 p.state = chara_state13;
191 return p; 190 return p;
192 } 191 }
193 192
194 chara_state11 = function character_state11( p ) 193 chara_state11 = function character_state11( p )
196 if(rinkf1 == 0) 195 if(rinkf1 == 0)
197 { 196 {
198 count++; 197 count++;
199 // DefSpriteEx(54, 16, 32); 198 // DefSpriteEx(54, 16, 32);
200 // PutSpriteEx(54, p.x, p.y, p.s, p.s, 1); 199 // PutSpriteEx(54, p.x, p.y, p.s, p.s, 1);
200
201 p.state = chara_state11; 201 p.state = chara_state11;
202 return p; 202 return p;
203 } 203 }
204 p.dt1 = 0; 204 p.dt1 = 0;
205 p.dt2 = 0; 205 p.dt2 = 0;
214 // if(p.y > 70+boss[1].h) 214 // if(p.y > 70+boss[1].h)
215 if(p.y > (240+32)*d_y) 215 if(p.y > (240+32)*d_y)
216 { 216 {
217 p.state = delete_chara; 217 p.state = delete_chara;
218 } 218 }
219 p.y += 0.3*d_y; 219 p.y += 0.3*d_y;
220 rinky += 0.3*d_y; 220 rinky += 0.3*d_y;
221 count++; 221 count++;
222 // DefSpriteEx(54, 16, 32); 222 // DefSpriteEx(54, 16, 32);
223 // PutSpriteEx(54, p.x, p.y, 2, 2, 1); 223 // PutSpriteEx(54, p.x, p.y, 2, 2, 1);
224 p.state = chara_state12; 224 p.state = chara_state12;
240 } 240 }
241 if((p.dt1 > 60) && (p.dt1 <= 70)) 241 if((p.dt1 > 60) && (p.dt1 <= 70))
242 { 242 {
243 if(p.dt1 % 2 == 1) 243 if(p.dt1 % 2 == 1)
244 { 244 {
245 Puttama(0, rinkx - 16 , rinky); 245 Puttama(0, rinkx/d_x - 16 , rinky/d_y);
246 Puttama(0, rinkx, rinky); 246 Puttama(0, rinkx/d_x, rinky/d_y);
247 Puttama(0, rinkx + 16, rinky); 247 Puttama(0, rinkx/d_x + 16, rinky/d_y);
248 } 248 }
249 } 249 }
250 if((p.dt1 > 180) && (p.dt1 <= 240)) 250 if((p.dt1 > 180) && (p.dt1 <= 240))
251 { 251 {
252 if(p.dt1 % 2 == 1) 252 if(p.dt1 % 2 == 1)
253 { 253 {
254 rinkf2 = 1; 254 rinkf2 = 1;
255 Puttama(2, rinkx - 16, p.y -32); 255 Puttama(2, rinkx/d_x - 16, p.y/d_y -32);
256 Puttama(3, rinkx + 32 - 16, p.y - 32); 256 Puttama(3, rinkx/d_x + 32 - 16, p.y/d_y - 32);
257 } 257 }
258 else 258 else
259 { 259 {
260 rinkf2 = 2; 260 rinkf2 = 2;
261 } 261 }
282 } 282 }
283 else p.vx = 0; 283 else p.vx = 0;
284 p.x += p.vx; 284 p.x += p.vx;
285 rinkx = p.x; 285 rinkx = p.x;
286 rinky = p.y; 286 rinky = p.y;
287 Puttama(4, rinkx - 8, rinky + 16); 287 Puttama(4, rinkx/d_x - 8, rinky/d_y + 16);
288 } 288 }
289 if((p.dt1 > 400) && (p.dt1 <= 500)) 289 if((p.dt1 > 400) && (p.dt1 <= 500))
290 { 290 {
291 rinkf2 = 4; 291 rinkf2 = 4;
292 if(jiki.x + 15*d_x - rinkx > 5*d_x) 292 if(jiki.x + 15*d_x - rinkx > 5*d_x)
293 { 293 {
294 p.vx = -1*_dx; 294 p.vx = -1*d_x;
295 } 295 }
296 else if(jiki.x + 15*d_x - rinkx > 5*d_x) 296 else if(jiki.x + 15*d_x - rinkx > 5*d_x)
297 { 297 {
298 p.vx = +1*d_x; 298 p.vx = +1*d_x;
299 } 299 }
328 count++; 328 count++;
329 // DefSpriteEx(54, 16, 32); 329 // DefSpriteEx(54, 16, 32);
330 // PutSpriteEx(54, p.x, p.y, 2, 2, 1); 330 // PutSpriteEx(54, p.x, p.y, 2, 2, 1);
331 p.state = chara_state12; 331 p.state = chara_state12;
332 return p; 332 return p;
333 333
334 } 334 }
335 335
336 chara_state13 = function character_state13(p) 336 chara_state13 = function character_state13(p)
337 { 337 {
338 if(tekino0.flag == false) 338 if(tekino0.flag == false)
349 p.dt2 = rinky; 349 p.dt2 = rinky;
350 if(rinkf2 == 1) 350 if(rinkf2 == 1)
351 { 351 {
352 if(p.x > rinkx * d_x) 352 if(p.x > rinkx * d_x)
353 { 353 {
354 Puttama(2, p.x + 32, p.y); 354 Puttama(2, p.x/d_x + 32, p.y/d_y);
355 } 355 }
356 } 356 }
357 if(rinkf2 == 4) 357 if(rinkf2 == 4)
358 { 358 {
359 count++; 359 count++;
360 // PutSprite(count, p.x, p.y + 56, 58+filpcount % 4); 360 // PutSprite(count, p.x, p.y + 56, 58+filpcount % 4);
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);
361 } 363 }
362 if(rinkf2 == 5) 364 if(rinkf2 == 5)
363 { 365 {
364 if(p.x > rinkx*d_x) 366 if(p.x > rinkx*d_x)
365 { 367 {
366 Puttama(5, p.x + 8 , p.y + 24); 368 Puttama(5, p.x/d_x + 8 , p.y/d_y + 24);
367 } 369 }
368 if(p.x < rinkx*d_x) 370 if(p.x < rinkx*d_x)
369 { 371 {
370 Puttama(5, p.x + 8, p.y + 24); 372 Puttama(5, p.x/d_x + 8, p.y/d_y + 24);
371 } 373 }
372 } 374 }
373 return p; 375 return p;
374 } 376 }
375 377
381 p.vx -= 0.5*d_x; 383 p.vx -= 0.5*d_x;
382 p.vy += 0.4*d_y; 384 p.vy += 0.4*d_y;
383 return p; 385 return p;
384 } 386 }
385 387
386 chara_state21 = function character_state(p) 388 chara_state21 = function character_state21(p)
387 { 389 {
388 p.x += p.vx; 390 p.x += p.vx;
389 p.y += p.vy; 391 p.y += p.vy;
390 p.vx += 0.5*d_x; 392 p.vx += 0.5*d_x;
391 p.vy += 0.4*d_y; 393 p.vy += 0.4*d_y;
392 return p; 394 return p;
393 } 395 }
396
397 chara_state22 = function character_state22(p)
398 {
399 sf = Math.random() % 4;
400 if((sf == 0) || (sf == 1))
401 {
402 p.x = -35;
403 p.y = Math.random() % (120 - 35);
404 p.vx = (Math.random() % 4 + 1);
405 p.vy = Math.random() % 3 + 1;
406 p.state = chara_state23;
407 }
408 if((sf == 2))
409 {
410 p.x = Math.random() % 290;
411 p.y = -30;
412 p.vx = Math.random() % 3 - 1;
413 p.vy = (Math.random() % 4 + 1);
414 p.state = chara_state23;
415 }
416 if(sf == 3)
417 {
418 p.x = 320;
419 p.y = Math.random() % (120 - 35);
420 p.vx = (Math.random() % 4 + 1) * -1;
421 p.vy = Math.random() % 3 -1;
422 p.state = chara_state23;
423 }
424 return p;
425 }
426
427
428
429 chara_state400 = function character_state400(p)
430 {
431 p.vy++;
432 p.y += p.vy / 4;
433 p.state = chara_state400;
434 return p;
435 }
436
437 chara_state401 = function character_state401(p)
438 {
439 {
440 p.vx++;
441 p.x += p.vx / 8;
442 if (p.x > (jiki.x - 32))
443 {
444 p.vy--;
445 }
446 p.y += p.vy / 8;
447 if (p.dt1 % 50 == 37)
448 {
449 Puttama(1, p.x + 8, p.y + 24);
450 }
451 p.dt1++;
452 return p;
453 }
454 }
455
456 chara_state402 = function character_state402(p)
457 {
458 p.vx--;
459 p.x += p.vx / 8;
460 if(p.x < (jiki.x + 32 * d_x))
461 {
462 p.vy--;
463 }
464 p.y += p.vy / 8;
465 if(p.dt1 % 50 == 37)
466 {
467 Puttama(1, p.x + 8, p.y + 42);
468 }
469 p.dt1++;
470 return p;
471 }