OSDN Git Service

TeleportMachine 鋳型
[h58pcdgame/GameScriptCoreLibrary.git] / www / corelib / classes / TeleportMachineClass.js
1 // args[0] : \83X\83e\81[\83W\96¼\82ð\95Ô\82·\8aÖ\90\94\81Bnull\82ð\8ew\92è\82·\82é\82Æ\83L\83\83\83\93\83Z\83\8b
2
3 var TeleportMachineClass = function(stage, args)
4 {
5         var that = this;
6         this.modalFunc = function(){
7                 that.teleporting = true;
8                 that.teleportTick = 0;
9         };
10         
11         
12         TeleportMachineClass.base.apply(this, [stage, ["teleport.png", function(){
13                 var ret = args[0]();
14                 if(ret)
15                 {
16                         that.ownerStage.manager.pauseStage(that.tick, that.modalFunc);
17                 }
18         }]]);
19         
20         this.times = -1;
21         this.touchInterval = 180;
22         this.mustSelectKey = true;
23         this.size.x = 96;
24         this.size.y = 256;
25         
26         this.teleporting = false;
27         this.teleportTick = 0;
28         
29         this.blindHeight = 0;
30         
31         this.tickCount = 0;
32         
33 }.extend(FreeItemClass, {
34         tick:function()
35         {
36                 TeleportMachineClass.base.tick.apply(this, []);
37                 var mainCharacter = this.ownerStage.userControlledCharacter;    //139
38                         
39                 if(this.teleporting)
40                 {
41                         if(++this.tickCount < 10) return;
42                         this.tickCount = 0;
43                         console.log(this.teleportTick);
44                         if(this.teleportTick < 42)      //\83e\83\8c\83|\81[\83g\83}\83V\83\93\82Ü\82Å\8fã\82é
45                         {
46                                 mainCharacter.origin.x = this.origin.x + (this.size.x - mainCharacter.size.x) / 2;
47                                 mainCharacter.origin.y = this.origin.y + this.size.y - mainCharacter.size.y - this.teleportTick;
48                         }else if(this.teleportTick < 45)        //\82·\82±\82µ\82Ü\82Â
49                         {
50                         
51                         }else   //\90U\93®\8aJ\8en
52                         {
53                                 this.forceTopMost = true;
54                                 mainCharacter.origin.x = this.origin.x + (this.size.x - mainCharacter.size.x) / 2 + (this.teleportTick % 2 = 0 ? -3 : 3);
55                                 if(this.teleportTick < 55)      //\90U\93®\82µ\82½\82Ü\82Ü\91Ò\82Â
56                                 {
57                                 }else if(this.teleportTick < 65)        //\83u\83\89\83C\83\93\83h\82ª\95Â\82\82é
58                                 {
59                                         this.blindHeight += 5;
60                                 }else if(this.teleportTick < 93)        //\8dÄ\93x\91Ò\82Â
61                                 {
62                                 }else
63                                 {
64                                         //\88Ú\93®!
65                                         this.teleporting = false;
66                                         showAlert(this.ownStage.manager, "\88Ú\93®\82µ\82Ü\82µ\82½");
67                                 }
68                         }
69                         
70                         this.teleportTick++;
71                 }
72         },
73         draw:function(x, y){
74                 TeleportMachineClass.base.prototype.draw.apply(this, [x, y]);
75                 this.ownerStage.mainContext.save();
76                 this.ownerStage.mainContext.fillStyle = "#4b97f2";
77                 this.ownerStage.mainContext.fillRect(0, 215 - this.blindHeight, this.size.x, this.blindHeight);
78                 this.ownerStage.mainContext.restore();
79         }
80 });