OSDN Git Service

WarpItemClass.js実装 未デバッグ
authorttwilb <ttwilb@users.sourceforge.jp>
Wed, 4 Sep 2013 03:52:52 +0000 (12:52 +0900)
committerttwilb <ttwilb@users.sourceforge.jp>
Wed, 4 Sep 2013 03:52:52 +0000 (12:52 +0900)
www/corelib/classes/WarpItemClass.js

index fead97e..c00712f 100644 (file)
@@ -3,11 +3,40 @@
 // args[2] : move_to y
 // args[3] : size_x
 // args[4] : size_y
-
-var WarpItemClass = function(){
-       WarpItemClass.base.apply(this, [false, function(main, obj_x, obj_y){
-               
-       }]);
+// args[5] : saveInertia  \8aµ\90«\8fó\91Ô\82ð\95Û\91
+var WarpItemClass = function(stage, args){
+       
+       var moveToX = args[1];
+       var moveToY = args[2];
+       var stgName = args[0];
+       var saveInertia = args[5] != undefined ? args[5] : false;
+       
+       WarpItemClass.base.apply(this, [stage, [false, function(main, obj_x, obj_y){
+               var spdx, spdy;
+               if(saveInertia)
+               {
+                       spdx = stage.userControlledCharacter.movingSpeed.x;
+                       spdy = stage.userControlledCharacter.movingSpeed.y;
+               }
+               if(stgName)
+               {
+                       stage.manager.loadStageFromNetwork(stgName);
+               }
+               var stg = stage.manager.runningStage;
+               if(moveToX != undefined)
+               {
+                       stg.userControlledCharacter.origin.x = moveToX;
+               }
+               if(moveToY != undefined)
+               {
+                       stg.userControlledCharacter.origin.y = moveToY;
+               }
+               if(saveInertia)
+               {
+                       stg.userControlledCharacter.movingSpeed.x = spdx;
+                       stg.userControlledCharacter.movingSpeed.y = spdy;
+               }
+       }]]);
        
        if(args[3])
        {
@@ -17,7 +46,6 @@ var WarpItemClass = function(){
        {
                this.size.y = args[4];
        }
-
 }.extend(FreeItemClass, {
-
+       
 });
\ No newline at end of file