Mercurial > hg > Members > e085711
view webGL/dandy/resources/Character_state.js @ 6:881478004f18
update Bullet.js
author | NOBUYASU Oshiro |
---|---|
date | Mon, 21 Jun 2010 17:37:26 +0900 |
parents | 7f615f5f5220 |
children | 4343c1feedb5 |
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.f == true) { p = p.state(p); } } } function Putenemy(charano, x, y, vx, vy, chara_state) { var p = new Character(); // p.collision = atari; p.x = x; p.y = y; p.vx = vx; p.vy = vy; // p.tama = tf; // p.vit = enemystate[charano].p; // p.score = enemystate[charano].sc; // p.s = 0; p.f = true; p.state = chara_state; loadEnemyImage(charano, p); active_chara_list.enemy.push(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; } function loadEnemyImage(charano, p) { if(charano == 0) { p.image = enemy[0]; p.texture = enemy[0].texture; } if(charano == 1) { p.image = enemy[1]; p.texture = enemy[1].texture; } if(charano == 2) { p.image = enemy[2]; p.texture = enemy[2].texture; } if(charano == 3) { p.image = enemy[3]; p.texture = enemy[3].texture; } }