OSDN Git Service

init
[h58pcdgame/GameScriptCoreLibrary.git] / www / stage / main.js
1 //ステージの設定
2 //      グローバル名前空間にmainManager,
3 //      ローカルに stageがすでに存在する状況下で呼ばれる。
4 //ステージのインスタンス変数
5 stage.moveForce = 50;
6
7 //関数のオーバーライド
8 stage.runStage = function(){
9         //元々定義されていた、疑似スーパークラス(prototype)の関数を呼び出す。
10         this.super_runStage();
11         for(i = 0; i < 2; i++){
12                 aCircle = new StageObject(this);
13                 aCircle.origin.x = 16 + 16 * i;
14                 aCircle.origin.y = 16 + 16 * i;
15                 aCircle.frame.origin.x = - (8 + i);
16                 aCircle.frame.origin.y = - (8 + i);
17                 aCircle.frame.size.x = 2 * (8 + i);
18                 aCircle.frame.size.y = 2 * (8 + i);
19                 
20                 this.addStageObject(aCircle);
21         }
22 }
23 stage.timerTick = function(){
24         this.super_timerTick();
25         if(this.manager.keyState.upArrow){
26                 //上カーソル
27                 for(i = 0; i < this.stageObjectList.length; i++){
28                         this.stageObjectList[i].movingSpeed.y -= this.moveForce;
29                 }
30         }
31
32         if(this.manager.keyState.downArrow){
33                 //下カーソル
34                 for(i = 0; i < this.stageObjectList.length; i++){
35                         this.stageObjectList[i].movingSpeed.y += this.moveForce;
36                 }
37         }
38         if(this.manager.keyState.leftArrow){
39                 //左カーソル
40                 for(i = 0; i < this.stageObjectList.length; i++){
41                         this.stageObjectList[i].movingSpeed.x -= this.moveForce;
42                 }
43         }
44         if(this.manager.keyState.rightArrow){
45                 //右カーソル
46                 for(i = 0; i < this.stageObjectList.length; i++){
47                         this.stageObjectList[i].movingSpeed.x += this.moveForce;
48                 }
49         }
50
51 }