OSDN Git Service

main.jsが動作しないバグ修正
authorttwilb <ttwilb@users.sourceforge.jp>
Mon, 5 Aug 2013 01:18:20 +0000 (10:18 +0900)
committerttwilb <ttwilb@users.sourceforge.jp>
Mon, 5 Aug 2013 01:18:20 +0000 (10:18 +0900)
www/corelib/classes/CharacterClass.js
www/corelib/classes/GameStageClass.js
www/corelib/classes/MovableStageObjectClass.js
www/corelib/core.js
www/index_local_debug.html
www/stage/main.js

index d29218e..960ae01 100644 (file)
@@ -6,7 +6,7 @@ var CharacterClass = function(stage)
        //\83L\83\83\83\89\93Æ\8e©\82Ì\8b@\94\\81i\82½\82Æ\82¦\82Î\8dU\8c\82\82â\91\8a\8eè\82ª\93\96\82½\82Á\82Ä\82«\82½\82Æ\82«\82Ì\82 \82½\82è\94»\92è\82È\82Ç)
        
 }.extend(MovableStageObjectClass, {
-       display: function(){
+       draw: function(){
                //\8cÊ\82Ì\95`\89æ
                this.stage.mainContext.save();
                this.stage.mainContext.fillStyle = "rgba(" + (((11*this.frame.size.x) & 0x7f) + 0x80) + "," + (((19*this.frame.size.x) & 0x7f) + 0x80) + "," + (((17*this.frame.size.x) & 0x7f) + 0x80) + ",0.5)";
@@ -17,6 +17,7 @@ var CharacterClass = function(stage)
        },
        tick: function(){
                MovableStageObjectClass.prototype.tick.apply(this, []);
+
        }
 });
 
index d998917..d6e9df9 100644 (file)
@@ -128,6 +128,16 @@ GameStage.prototype = {
                                removeObjectFromArray(this.stageObjectList, sp);
                        }
                }
+       },
+       eachStageObject: function(f){
+               for(var sp in this.stageObjectList)
+               {
+                       for(i = 0; i < this.stageObjectList[sp].length; i++){
+                               
+                               var stgobj = this.stageObjectList[sp][i];
+                               f(stgobj);
+                       }
+               }
        }
 };
 
index e3408f7..1ece096 100644 (file)
@@ -10,6 +10,8 @@ var MovableStageObjectClass = function(stage)
        
 }.extend(StageObject, {
        tick: function(){
+
+
                //\96\80\8eC\8f\88\97\9d
                if(this.movingSpeed.x < -this.hysteresis){
                        this.movingSpeed.x += this.movingFriction / this.stage.manager.tickPerSecond;
@@ -49,8 +51,7 @@ var MovableStageObjectClass = function(stage)
                        this.origin.y = this.stage.mainCanvas.height - (this.frame.origin.y + this.frame.size.y);
                        this.movingSpeed.y = -this.movingSpeed.y;
                }
-               
-               this.display();
+
        }
 });
 
index 19d7e27..c066221 100755 (executable)
@@ -181,6 +181,7 @@ GameManager.prototype = {
                //実行中のステージに通知
                if(this.runningStage){
                        this.runningStage.timerTick();
+                       this.runningStage.draw();
                }
        },
        timeStampTimerTick: function(){
index 14906dc..a45fd8c 100644 (file)
@@ -49,8 +49,7 @@ function save()
        <div style="position: absolute; left: 650px; top: 0; right: 0; z-index: 1">
                <form>
                <textarea id="stageCode" rows="60" style="width: 100%; height: 90%">
-               
-//ステージの設定
+               //ステージの設定
 //     グローバル名前空間にmainManagerがすでに存在する状況下で呼ばれる。
 //     最初の行で新たなインスタンスを生成し、最後のreturnでそれを返す。
 
@@ -73,34 +72,24 @@ stage.runStage = function(){
                
                this.addStageObject(aCircle);
        }
-}
+};
 stage.timerTick = function(){
        GameStage.prototype.timerTick.apply(stage, []);
        if(this.manager.keyState.upArrow){
                //上カーソル
-               for(i = 0; i < this.stageObjectList.length; i++){
-                       this.stageObjectList[i].movingSpeed.y -= this.moveForce;
-               }
+               stage.eachStageObject(function(item){item.movingSpeed.y -= stage.moveForce; });
        }
        if(this.manager.keyState.downArrow){
                //下カーソル
-               for(i = 0; i < this.stageObjectList.length; i++){
-                       this.stageObjectList[i].movingSpeed.y += this.moveForce;
-               }
+               stage.eachStageObject(function(item){item.movingSpeed.y += stage.moveForce;});
        }
        if(this.manager.keyState.leftArrow){
-               //左カーソル
-               for(i = 0; i < this.stageObjectList.length; i++){
-                       this.stageObjectList[i].movingSpeed.x -= this.moveForce;
-               }
+               stage.eachStageObject(function(item){item.movingSpeed.x -= stage.moveForce;});
        }
        if(this.manager.keyState.rightArrow){
                //右カーソル
-               for(i = 0; i < this.stageObjectList.length; i++){
-                       this.stageObjectList[i].movingSpeed.x += this.moveForce;
-               }
+                stage.eachStageObject(function(item){item.movingSpeed.x += stage.moveForce;});
        }
-
 };
 
 stage;
index d41aa35..d549079 100644 (file)
@@ -26,29 +26,19 @@ stage.timerTick = function(){
        GameStage.prototype.timerTick.apply(stage, []);
        if(this.manager.keyState.upArrow){
                //上カーソル
-               for(i = 0; i < this.stageObjectList.length; i++){
-                       this.stageObjectList[i].movingSpeed.y -= this.moveForce;
-               }
+               stage.eachStageObject(function(item){item.movingSpeed.y -= stage.moveForce; });
        }
        if(this.manager.keyState.downArrow){
                //下カーソル
-               for(i = 0; i < this.stageObjectList.length; i++){
-                       this.stageObjectList[i].movingSpeed.y += this.moveForce;
-               }
+               stage.eachStageObject(function(item){item.movingSpeed.y += stage.moveForce;});
        }
        if(this.manager.keyState.leftArrow){
-               //左カーソル
-               for(i = 0; i < this.stageObjectList.length; i++){
-                       this.stageObjectList[i].movingSpeed.x -= this.moveForce;
-               }
+               stage.eachStageObject(function(item){item.movingSpeed.x -= stage.moveForce;});
        }
        if(this.manager.keyState.rightArrow){
                //右カーソル
-               for(i = 0; i < this.stageObjectList.length; i++){
-                       this.stageObjectList[i].movingSpeed.x += this.moveForce;
-               }
+                stage.eachStageObject(function(item){item.movingSpeed.x += stage.moveForce;});
        }
-
 };
 
 stage;