OSDN Git Service

れいむをFormSpriteに対応
authornagoling <>
Mon, 16 Dec 2013 22:34:20 +0000 (07:34 +0900)
committernagomi <nagomi@192.168.1.23>
Mon, 16 Dec 2013 22:34:20 +0000 (07:34 +0900)
lib/FormSprite.js
main.js

index cb6a276..c4fd3ef 100644 (file)
@@ -32,6 +32,7 @@ var FormSprite = enchant.Class.create({
                this.spriteArray[index] = sprite;
                this.spriteArray[index].type = attr.type;
                this.spriteArray[index].scaleValue = attr.scaleValue;
+               this.spriteArray[index].spname = attr.spname;
                if(attr.mainIndexFlg){
                        this.mainIndex = index;
                }
diff --git a/main.js b/main.js
index eeb810d..7691739 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;
                }
@@ -1875,13 +1879,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,7 +2035,7 @@ 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();
@@ -2664,7 +2668,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 +2735,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 +2753,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 +2784,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 +2825,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 +2901,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);