OSDN Git Service

update
[yukkurioverwint/YukkuriOverwinter.git] / main.js
diff --git a/main.js b/main.js
index eeb810d..9da106e 100644 (file)
--- a/main.js
+++ b/main.js
@@ -341,14 +341,15 @@ window.onload = function(){
                var shadowValue = -28;
                //okazariは他のbodyと比べて11低い
                var okazariValue = 37 + 11;
+               var okazariReimuValue = 32;
                var bodyValue = 37;
-               var tweetValue = 148;
+               var tweetValue = 188;
 
                if(a.type == "shadow"){
                        ay += shadowValue * a.scaleValue;
                }
-               else if(a.type == "body" && a.classname == "Okazari"){
-                       ay += okazariValue * a.scaleValue - a.anim.cnt;
+               else if(a.type == "body" && a.classname == "Okazari" && a.spname == "reimu"){
+                       ay += okazariReimuValue * a.scaleValue - a.anim.cnt;
                }
                else if(a.type == "body"){
                        ay += bodyValue * a.scaleValue - a.anim.cnt;
@@ -364,6 +365,9 @@ window.onload = function(){
                        by += shadowValue * b.scaleValue;
                }
 
+               else if(b.type == "body" && b.classname == "Okazari" && b.spname == "reimu"){
+                       by += okazariReimuValue * b.scaleValue - b.anim.cnt;
+               }
                else if(b.type == "body" && b.classname == "Okazari"){
                        by += okazariValue * b.scaleValue - b.anim.cnt;
                }
@@ -940,6 +944,14 @@ window.onload = function(){
                                yukkuri.action.setStatus(EAction.MOVE_TO_COMMAND);
                                return;
                        }
+                       if(yukkuri.isSleep()){
+                               yukkuri.action.setStatus(EAction.SLEEP_START);
+                               return;
+                       }
+                       else if(yukkuri.getUnun() >= 80){
+                               yukkuri.action.setStatus(EAction.UNUN_START);
+                               return;
+                       }
 
                        if(yukkuri.isItemsMax() && yukkuri.isPlace()){
                                yukkuri.action.targetNode = yukkuri.getPlace();
@@ -974,15 +986,6 @@ window.onload = function(){
                                return;
                        }
 
-                       if(yukkuri.isSleep()){
-                               yukkuri.action.setStatus(EAction.SLEEP_START);
-                               return;
-                       }
-
-                       else if(yukkuri.getUnun() >= 80){
-                               yukkuri.action.setStatus(EAction.UNUN_START);
-                               return;
-                       }
 
 
                        if(!yukkuri.isItemsMax() && yukkuri.isPlace()){
@@ -1875,13 +1878,13 @@ window.onload = function(){
                        if(yukkuri.myCode === "REIMU"){
                                enchant.Sprite.call(this, 80, 32);
                                this.image = game.assets[EResPathReimu.OKAZARI];
-                               this.x = -CHARA_WIDTH / 2 - 1;
-                               this.y = 0;
+                               this.x = -CHARA_WIDTH / 3 * 2;
+                               this.y = -yukkuri.getHeight()/5 * 2 - 4;
                        }else{
                                enchant.Sprite.call(this, 64, 64);
                                this.image = game.assets[EResPath.MARISA_OKAZARI];
                                this.x = -CHARA_WIDTH / 2;
-                               this.y = -CHARA_HEIGHT / 2 - yukkuri.getWidth()/6;
+                               this.y = -CHARA_HEIGHT / 2 - yukkuri.getHeight()/6;
                        }
                        this.yukkuri = yukkuri;
                },
@@ -2031,14 +2034,15 @@ window.onload = function(){
                                                // this.kukis[0].miYukkuris[0].animY(-_y);
                                        }
                                        // console.log(this.getX() + ":" + this.getY());
-                                       // this.act();
+                                       this.act();
                                        if(this.isDead())return;
                                        this.runYukkuri();
                                        this.runHungry();
                                        this.runUnun();
                                        this.runSleep();
                                        this.runAddress();
-                                       this.formSprite.animation();
+                                       this.runAnimation();
+                                       // this.animation();
 
                                }
                        // }catch(e){
@@ -2105,9 +2109,11 @@ window.onload = function(){
                act: function(){
                        this.action.act();
                },
-
+               runAnimation: function(){
+                       this.formSprite.formRunAnimation();
+               },
                animation: function(){
-                       this.formSprite.animation();
+                       this.formSprite.formStartAnimation();
                        // var frame = 10;
                        // frame -= plusFrameScale(frame, this.getMyScale()) / 2;
                        // var move = 5;
@@ -2192,7 +2198,7 @@ window.onload = function(){
                },
                runSleep: function(){
                        if(this.action.getStatus() != EAction.SLEEP_START && this.action.getStatus() != EAction.SLEEP_WAIT){
-                               if(this.age%80 === 0 && this.age !== 0)this.param.sleep++;
+                               if(this.age%80 === 0 && this.age !== 0)this.param.sleep += 1;
                                if(this.param.sleep >= 100){
                                        this.param.sleep = 100;
                                }
@@ -2341,7 +2347,7 @@ window.onload = function(){
                        // this.imgBody.tl.unloop();
                        // this.imgGroup.tl.unloop();
                        // this.imgBody.y = 0;
-
+                       this.formSprite.formStopAnimation();
                },
                tlResume: function(){
                        // this.imgBody.tl.resume();
@@ -2614,7 +2620,7 @@ window.onload = function(){
                        this.kukis[3] = new Kuki(this, -5, 5);
                        this._tweet = new TTweet(this, 148, 64);
 
-                       this.formSprite.addChild(this.shadow,0,{type:"shadow",scaleValue:this.myScaleY});
+                       this.formSprite.addChild(this.shadow,0,{type:"shadow",shadowIndexFlg:true,scaleValue:this.myScaleY});
                        this.formSprite.addChild(this, 1, {
                                mainIndexFlg:true,
                                type : "body",
@@ -2664,7 +2670,8 @@ window.onload = function(){
                        // this.imgGroup.addChild(this._tweet);
                        // this.imgGroup.x = x;
                        // this.imgGroup.y = y;
-
+                       this.formSprite.setX(x);
+                       this.formSprite.setY(y);
                        this.animation();
                        this.action = new Action(this);
                        ctl.addObj(this);
@@ -2730,7 +2737,6 @@ window.onload = function(){
                        this.classname = "Reimu";
                        this.myCode = "REIMU";
                        this.myName = "れいむ";
-
                        // var xml = this.loadParamsXML("./data/marisa/params.xml");
                        // var json = net.load("./data/reimu/params.json");
                        // this.param = json.root.param;
@@ -2749,9 +2755,7 @@ window.onload = function(){
                        this.shadow.image = game.assets[EResPath.YUKKURI_SHADOW];
                        this.shadow.x = 0 + this.x;
                        this.shadow.y = this.getWidth() / 16 + this.x;
-                       this.shadow.image._element.style.zIndex = 2;
 
-                       this._style.zIndex = 5;
 
                        this.face = new enchant.Sprite(64, 64);
                        this.face.image = game.assets[EResPathReimu.FACE_NORMAL];
@@ -2782,8 +2786,19 @@ window.onload = function(){
                        this.sub1.x = -CHARA_WIDTH / 2;
                        this.sub1.y = -CHARA_HEIGHT / 2;
 
-                       this.okazari = new Okazari(this);
 
+                       this.okazari = new Okazari(this);
+                       this.formSprite.addChild(this.shadow,0,{type:"shadow",scaleValue:this.myScaleY});
+                       this.formSprite.addChild(this, 1, {
+                               mainIndexFlg:true,
+                               type : "body",
+                               scaleValue:this.myScaleY
+                       });
+                       this.formSprite.addChild(this.face,2,{type:"body",scaleValue:this.myScaleY});
+                       this.formSprite.addChild(this.hear,3,{type:"body",scaleValue:this.myScaleY});
+                       this.formSprite.addChild(this.okazari,4,{type:"body",scaleValue:this.myScaleY,spname:"reimu"});
+                       this.formSprite.addChild(this.sub1,5,{type:"body",scaleValue:this.myScaleY});
+                       // this.formSprite.addChild(this._tweet,6,{type:"tweet",scaleValue:this.myScaleY});
 
                        // this.imgGroup.addChild(this.shadow);
                        // this.imgBody.addChild(this.okazari);
@@ -2812,6 +2827,8 @@ window.onload = function(){
                        // this.imgGroup.x = x;
                        // this.imgGroup.y = y;
 
+                       this.formSprite.setX(x);
+                       this.formSprite.setY(y);
                        this.animation();
                        this.action = new Action(this);
                        ctl.addObj(this);
@@ -2886,7 +2903,7 @@ window.onload = function(){
                // new Marisa(PALYER_INIT_X + 100, PALYER_INIT_Y + 200, EGrow.SUBADULT);
                // new Marisa(PALYER_INIT_X + 150, PALYER_INIT_Y + 200, EGrow.CHILD);
                // new Marisa(PALYER_INIT_X + 200, PALYER_INIT_Y + 200, EGrow.BABY);
-               // // new Reimu(PALYER_INIT_X + 400, PALYER_INIT_Y + 400, EGrow.ADULT);
+               //new Reimu(PALYER_INIT_X + 100, PALYER_INIT_Y + 100, EGrow.ADULT);
                // new Reimu(PALYER_INIT_X + 350, PALYER_INIT_Y + 400, EGrow.SUBADULT);
                // new Reimu(PALYER_INIT_X + 300, PALYER_INIT_Y + 400, EGrow.CHILD);
                // new Reimu(PALYER_INIT_X + 250, PALYER_INIT_Y + 400, EGrow.BABY);