diff webGL/dandy/resources/Character.js~ @ 7:4343c1feedb5

upload boss.js xmlAlpha file
author NOBUYASU Oshiro
date Mon, 05 Jul 2010 17:19:51 +0900
parents 881478004f18
children 03b67cd2bde7
line wrap: on
line diff
--- a/webGL/dandy/resources/Character.js~	Mon Jun 21 17:37:26 2010 +0900
+++ b/webGL/dandy/resources/Character.js~	Mon Jul 05 17:19:51 2010 +0900
@@ -1,17 +1,6 @@
 active_chara_list = new Object();
 active_chara_list.enemy = [];
 
-function loadXml(gl,url)
-{
-    gl.chara = new Object();
-    var xmlChara = new Object();
-    xmlChara = parsePanel(url);
-    for (var name in xmlChara) 
-	{
-	    gl.chara[name] = makeXmlObj(gl, xmlChara[name]);
-	    gl.chara[name].texture = loadImageTexture(gl, xmlChara[name].image);
-	}
-}
 
 function Character()
 {
@@ -19,6 +8,8 @@
     this.y=0;
     this.dx=0;
     this.dy=0;
+    this.w=0;
+    this.h=0;
     this.vit=0;
     this.score=0;
     this.dt1=0;
@@ -26,6 +17,7 @@
     this.charano=0;
     this.tama=0;
     this.f=false;
+    this.flag=false;
     this.s=0;
 
     this.state=0;
@@ -50,7 +42,6 @@
 				
     ctx.bindBuffer(ctx.ARRAY_BUFFER, glObj.image.vertexObject);
     ctx.vertexAttribPointer(2, 3, ctx.FLOAT, false, 0, 0);
-    
     ctx.bindBuffer(ctx.ARRAY_BUFFER, glObj.image.normalObject);
     ctx.vertexAttribPointer(0, 3, ctx.FLOAT, false, 0, 0);
     
@@ -85,9 +76,14 @@
 {
     for(var i = 0; Boolean(active_chara_list.enemy[i]) ; i++)
 	{
-	    if(active_chara_list.enemy[i].f == true)
+	    if(active_chara_list.enemy[i].flag == true)
 		{
 		    PutSprite(ctx,active_chara_list.enemy[i]);
 		}
+	    //敵が消えたら配列から消す
+	    if(active_chara_list.enemy[i].flag == false)
+		{
+		    active_chara_list.enemy.splice(i,1);
+		}
 	}
 }