//\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)";
},
tick: function(){
MovableStageObjectClass.prototype.tick.apply(this, []);
+
}
});
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);
+ }
+ }
}
};
}.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;
this.origin.y = this.stage.mainCanvas.height - (this.frame.origin.y + this.frame.size.y);
this.movingSpeed.y = -this.movingSpeed.y;
}
-
- this.display();
+
}
});
//実行中のステージに通知
if(this.runningStage){
this.runningStage.timerTick();
+ this.runningStage.draw();
}
},
timeStampTimerTick: function(){
<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でそれを返す。
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;
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;