Mercurial > hg > Members > e085711
view webGL/dandy/resources/Character_state.js~ @ 11:680b5b0cd1e4
upload
author | NOBUYASU Oshiro |
---|---|
date | Mon, 12 Jul 2010 08:01:12 +0900 |
parents | 1d76f5717ba7 |
children | 61febc94fa62 |
line wrap: on
line source
function state_update() { for(var i = 0; Boolean(active_chara_list.enemy[i]) ; i++) { var p = active_chara_list.enemy[i]; if(p.flag == true) { p = p.state(p); } } } noaction = function no_action(p) { p.state = noaction; return p; } delete_chara = function delete_character( p ) { p.state = noaction; p.flag = false; return p; } chara_state0 = function character_state0( p ) { p.x += p.vx; p.y += p.vy; p.state = chara_state0; return p; } chara_state1 = function character_state1( p ) { p.x -= p.vx; p.y -= p.vy; p.state = chara_state1; return p; } chara_state2 = function character_state2( p ) { p.x -= 0.25; p.y += p.vy; p.state = chara_state2; return p; } chara_state3 = function character_state3( p ) { p.x += p.vx; p.y += p.vy; if((p.dt1 == 60) || (p.dt1 == 90) || (p.dt1 == 30)) { Puttama(0, p.x, p.y); } p.dt1++; p.state = chara_state3; return p; } chara_state8 = function character_state8( p ) { if(p.y > 0) { p.y -= p.vy; /* tekino0 = p; kyeenmyno = p; count++; DefSpriteEx(p.charano, 16*4, 32*4); PutSpriteEx(p.charano, (p.x * 4), (p.y * 4), 0.2, 0.2, 1); */ p.dt1 = 512; p.s = 0.125; p.state = chara_state8; return p; } p.state = chara_state9; return p; } chara_state9 = function character_state9( p ) { if(p.s <= 2) { p.s += 0.05 p.y += 0.12; count++; // DefSpriteEx(54, 16*4, 32*4); // PutSpriteEx(54, (p.x * 4), (p.y * 4), p.x, p.x, 1); p.state = chara_state9; return p; } count++; rinkx = p.x; rinky = p.y; // DefSpriteEx(54, 16,32); // PutSpriteEx(54, p.x, p.y, p.s, p.s, 1); // Putenemy(5, rinkx - 16, rinky -16, 1, 0, chara_state10); // Putenemy(5, rinkx - 16, rinky -16, -1, 0, chara_state10); PutBoss(2, rinkx - 16, rinky -16, 1, 0, chara_state10); PutBoss(2, rinkx - 16, rinky -16, -1, 0, chara_state10); p.state = chara_state11; p.dt1 = 8192; return p; } chara_state10 = function character_state10( p ) { if(p.dt1 < 48) { p.x += p.vx; p.y += p.vy; p.dt1++; p.state = chara_state10; return p; } rinkf1 = 1; p.dt1 = rinkx; p.dt2 = rinky; p.state = chara_state13; return p; } chara_state11 = function character_state11( p ) { if(rinkf1 == 0) { count++; // DefSpriteEx(54, 16, 32); // PutSpriteEx(54, p.x, p.y, p.s, p.s, 1); p.state = chara_state11; return p; } p.dt1 = 0; p.dt2 = 0; p.state = chara_state12; return p; } chara_state12 = function character_state12( p ) { if(fastebos > 60+60) { if(p.y > 70+boss[1].h) { p.state = delete_chara; } p.y += 0.3; rinky += 0.3; count++; // DefSpriteEx(54, 16, 32); // PutSpriteEx(54, p.x, p.y, 2, 2, 1); p.state = chara_state12; return p; } if(p.dt1 <= 60) { if(jiki.x + 15 -rinkx < -5) { p.vx = -0.3; } else if(jiki.x + 15 - rinkx > 5) { p.vx = +0.8; } else p.vx = 0; rinkx = p.x; rinky = p.y; } if((p.dt1 > 60) && (p.dt1 <= 70)) { if(p.dt1 % 2 == 1) { // Puttama(0, rinkx - 16, rinky); // Puttama(0, rinkx, rinky); // Puttama(0, rinkx + 16, rinky); } } if((p.dt1 > 180) && (p.dt1 <= 240)) { if(p.dt1 % 2 == 1) { rinkf2 = 1; // Puttama(2, rinkx - 16, p.y -32); // Puttama(3, rinkx + 32 - 16, p.y - 32); } else { rinkf2 = 2; } } if(p.df1 > 240) { rinkf2 = 2; } if((p.dt1 > 240) && (p.dt1 <= 400)) { count++; // PutSprite(count, rinkx - 16, rinky + 32, 58 + p.dt1 %4) } if((p.dt1 > 300) && (p.dt1 <= 400)) { rinkf2 = 3; if(jiki.x + 15 - rinkx < -5) { p.vx = -1; } else if(jiki.x + 15 - rinkx > 5) { p.vx = +1; } else p.vx = 0; p.x += p.vx; rinkx = p.x; rinky = p.y; // Puttama(4, rinkx - 8, rinky + 16); } if((p.dt1 > 400) && (p.dt1 <= 500)) { rinkf2 = 4; if(jiki.x + 15 - rinkx > 5) { p.vx = -1; } else if(jiki.x + 15 - rinkx >5) { p.vx = +1; } else p.vx = 0; p.x += p.vx; rinkx = p.x; rinky = p.y; } if(p.dt1 > 500) { rinkf2 = 5; if(jiki.x + 15 - rinkx < -5) { p.vx = -1; } else if(jiki.x + 15 - rinkx > 5) { p.vx = +1; } else p.vx = 0; p.x += p.vx; rinkx = p.x; rinky = p.y; } if(p.dt1 > 600) { rinkf2 = 0; p.dt1 = 0; } fastebos++; p.dt1++; count++; // DefSpriteEx(54, 16, 32); // PutSpriteEx(54, p.x, p.y, 2, 2, 1); p.state = chara_state12; return p; } chara_state13 = function character_state13(p) { if(tekino0.flag == false) { // Bom(p.x, p.y); p.flag = false; p.state = delete_chara; p.collision = noaction; return p; } p.x += rinkx - p.dt1; p.y += rinky -p.dt2; p.dt1 = rinkx; p.dt2 = rinky; if(rinkf2 == 1) { if(p.x > rinkx) { Puttama(2, p.x + 32, p.y); } } if(rinkf2 == 4) { count++; // PutSprite(count, p.x, p.y + 56, 58+filpcount % 4); } if(rinkf2 == 5) { if(p.x > rinkx) { // Puttama(5, p.x + 8, p.y + 24); } if(p.x < rinkx) { // Puttama(5, p.x + 8, p.y + 24); } } return p; }