OSDN Git Service

実ゆっくりに向きを追加。次回は左向きのときの座標あわせを行う。TODO要確認
[yukkurioverwint/YukkuriOverwinter.git] / main.js
diff --git a/main.js b/main.js
index 7691739..04b6f62 100644 (file)
--- a/main.js
+++ b/main.js
@@ -33,7 +33,7 @@ var CHARA_WIDTH = 64;
 var CHARA_HEIGHT = 64;
 var GAME_WIDTH = 800;
 var GAME_HEIGHT = 600;
-var FPS = 20;
+var FPS = 40;
 var BASE_FPS = 20;
 var HUNGRY_MAX = 100;
 var TIME_SPEED = 4;
@@ -70,6 +70,7 @@ var EResPath = {
        GRASS : './data/system/grass.png',
        PLAYER_BADGE : './data/system/player_badge.png',
        KUKI : './data/system/kuki.png',
+       MIYUKKURI : './data/system/miyukkuri.png',
        // PLACE_TREE : './data/system/rapture.png',
 };
 var EResPathReimu = {
@@ -163,6 +164,9 @@ var EAction = {
        EAT_IN_HOME: 31,
        NONE: 9999
 };
+var EDeepSay = {
+
+}
 var EDirection = {
        LEFT : 0,
        RIGHT: 1,
@@ -235,9 +239,9 @@ var EDamage = {
        PICOHAN : 1
 };
 var ELooks = {
-       GOOD_YUKKURI : 0,
-       NORMAL_YUKKURI : 1,
-       BAD_YUKKURI : 2,
+       GOOD_YUKKURI : 3,
+       NORMAL_YUKKURI : 2,
+       BAD_YUKKURI : 1,
 };
 var EAnimStatus = {
        UP : 0,
@@ -245,6 +249,7 @@ var EAnimStatus = {
 };
 include("./lib/Animation.js"); 
 include("./lib/FormSprite.js"); 
+include("./lib/Util.js"); 
 
 
 var ObjSprite = enchant.Class.create(enchant.Sprite,{
@@ -343,7 +348,9 @@ window.onload = function(){
                var okazariValue = 37 + 11;
                var okazariReimuValue = 32;
                var bodyValue = 37;
-               var tweetValue = 188;
+               var tweetValue = 288;
+               var kukiValue = 143;
+               var miYukkuriValue = 363;
 
                if(a.type == "shadow"){
                        ay += shadowValue * a.scaleValue;
@@ -360,11 +367,14 @@ window.onload = function(){
                else if(a.type == "budge"){
                        ay += budgeValue * a.scaleValue - a.anim.cnt;
                }
+               else if(a.type == "kuki"){
+                       ay += kukiValue * a.scaleValue - a.anim.cnt;
+               }
+
 
                if(b.type == "shadow"){
                        by += shadowValue * b.scaleValue;
                }
-
                else if(b.type == "body" && b.classname == "Okazari" && b.spname == "reimu"){
                        by += okazariReimuValue * b.scaleValue - b.anim.cnt;
                }
@@ -380,6 +390,10 @@ window.onload = function(){
                else if(b.type == "budge"){
                        by += budgeValue * b.scaleValue - b.anim.cnt;
                }
+               else if(b.type == "kuki"){
+                       by += kukiValue * b.scaleValue - b.anim.cnt;
+               }
+
 
 
                if(a instanceof SpriteGroup){
@@ -390,6 +404,13 @@ window.onload = function(){
                        by = b.y;
                        by += b.height /2;
                }
+               if(a instanceof MiYukkuri){
+                       ay += miYukkuriValue * a.scaleValue - a.anim.cnt;
+               }
+               if(b instanceof MiYukkuri){
+                       console.log("M");
+                       by += miYukkuriValue * b.scaleValue - b.anim.cnt;
+               }
 
                if(a instanceof Place){
                        ay += Math.round(a.height * 0.7);
@@ -677,7 +698,7 @@ window.onload = function(){
                                        if(false){
                                                this.yukkuri.vx = xpos;
                                                this.yukkuri.vy = ypos;
-                                               this.yukkuri.direction = EDirection.RIGHT;
+                                               this.yukkuri.setDirection(EDirection.RIGHT);
                                        }
                                        else if(rand(8) === 0){
                                                this.yukkuri.vx = 0;
@@ -686,17 +707,17 @@ window.onload = function(){
                                        else if(rand(8) == 1){
                                                this.yukkuri.vx = xpos;
                                                this.yukkuri.vy = -ypos;
-                                               this.yukkuri.direction = EDirection.RIGHT;
+                                               this.yukkuri.setDirection(EDirection.RIGHT);
                                        }
                                        else if(rand(8) == 2){
                                                this.yukkuri.vx = xpos;
                                                this.yukkuri.vy = 0;
-                                               this.yukkuri.direction = EDirection.RIGHT;
+                                               this.yukkuri.setDirection(EDirection.RIGHT);
                                        }
                                        else if(rand(8) == 3){
                                                this.yukkuri.vx = xpos;
                                                this.yukkuri.vy = ypos;
-                                               this.yukkuri.direction = EDirection.RIGHT;
+                                               this.yukkuri.setDirection(EDirection.RIGHT);
                                        }
                                        else if(rand(8) == 4){
                                                this.yukkuri.vx = 0;
@@ -705,17 +726,17 @@ window.onload = function(){
                                        else if(rand(8) == 5){
                                                this.yukkuri.vx = -xpos;
                                                this.yukkuri.vy = ypos;
-                                               this.yukkuri.direction = EDirection.LEFT;
+                                               this.yukkuri.setDirection(EDirection.LEFT);
                                        }
                                        else if(rand(8) == 6){
                                                this.yukkuri.vx = -xpos;
                                                this.yukkuri.vy = 0;
-                                               this.yukkuri.direction = EDirection.LEFT;
+                                               this.yukkuri.setDirection(EDirection.LEFT);
                                        }
                                        else if(rand(8) == 7){
                                                this.yukkuri.vx = -xpos;
                                                this.yukkuri.vy = -ypos;
-                                               this.yukkuri.direction = EDirection.LEFT;
+                                               this.yukkuri.setDirection(EDirection.LEFT);
                                        }
                                        if (this.yukkuri.vx || this.yukkuri.vy) {
                                                var map = ctl.backgroundMap;
@@ -944,6 +965,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();
@@ -978,15 +1007,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()){
@@ -1222,7 +1242,7 @@ window.onload = function(){
                                var distance = (Math.abs(yukkuri.vx) + Math.abs(yukkuri.vy)) / 2;
                                var frame = distance + distance/5 + 1;
                                frame += plusFrameScale(frame, this.yukkuri.getMyScale());
-                               yukkuri.direction = yukkuri.vx > 0 ? EDirection.RIGHT : EDirection.LEFT;
+                               yukkuri.setAutoDirection();
                                yukkuri.reverse();
                                mangMsg.output(yukkuri, EMsg.TARGETING_EAT);
 
@@ -1266,7 +1286,7 @@ window.onload = function(){
                                var distance = (Math.abs(yukkuri.vx) + Math.abs(yukkuri.vy)) / 2;
                                var frame = distance + distance/5 + 1;
                                frame += plusFrameScale(frame, this.yukkuri.getMyScale());
-                               yukkuri.direction = yukkuri.vx > 0 ? EDirection.RIGHT : EDirection.LEFT;
+                               yukkuri.setAutoDirection();
                                yukkuri.reverse();
                                mangMsg.output(yukkuri, EMsg.MOVE_TO_HUNTING);
 
@@ -1384,7 +1404,8 @@ window.onload = function(){
                                var distance = (Math.abs(yukkuri.vx) + Math.abs(yukkuri.vy)) / 2;
                                var frame = distance + distance/2 + 1 ;
                                frame += plusFrameScale(frame, this.yukkuri.getMyScale());
-                               yukkuri.direction = yukkuri.vx > 0 ? EDirection.RIGHT : EDirection.LEFT;
+                               yukkuri.setAutoDirection();
+
                                yukkuri.reverse();
                                mangMsg.output(this.yukkuri, EMsg.MOVE_GOTO_HOME)
 
@@ -1533,7 +1554,7 @@ window.onload = function(){
                        var frame = distance + distance/2 + 1;
                        frame += plusFrameScale(frame, this.yukkuri.getMyScale());
 
-                       yukkuri.direction = yukkuri.vx > 0 ? EDirection.RIGHT : EDirection.LEFT;
+                       yukkuri.setAutoDirection();
 
                        yukkuri.moveBy(yukkuri.vx, yukkuri.vy, frame, {
                                "onactiontick": this.onactiontick(this),
@@ -1649,7 +1670,7 @@ window.onload = function(){
                        var frame = distance + distance/5 + 1;
                        frame += plusFrameScale(frame, this.yukkuri.getMyScale());
 
-                       yukkuri.direction = yukkuri.vx > 0 ? EDirection.RIGHT : EDirection.LEFT;
+                       yukkuri.setAutoDirection();
                        yukkuri.reverse();
                        yukkuri.moveBy(yukkuri.vx, yukkuri.vy, frame, {
                                "onactionend": this.onactionend(this)
@@ -1909,10 +1930,13 @@ window.onload = function(){
                        this.miYukkuris = [];
                },
                addMiYukkuri: function(miYukkuri){
-                       miYukkuri.setX(miYukkuri.getX() + 30);
-                       miYukkuri.setY(miYukkuri.getY() - 30);
+                       // miYukkuri.setX(miYukkuri.getX() + 30);
+                       // miYukkuri.setY(miYukkuri.getY() - 30);
                        this.miYukkuris.push(miYukkuri);
                },
+               getMiYukkuris: function(){
+                       return this.miYukkuris;
+               },
                getX : function(){
                        return this.x;
                },
@@ -1996,7 +2020,7 @@ window.onload = function(){
                        this.vx = 0;
                        this.vy = 0;
                        this.image = game.assets[EResPath.YUKKURI_BASE];
-                       this.direction = EDirection.RIGHT;
+                       this.setDirection(EDirection.RIGHT);
                        this.addEventListener('enterframe', this.runEnterframe);
                        this.bodyStatus ={};
                        this.bodyStatus[EBody.NORMAL] = EResPath.YUKKURI_BASE;
@@ -2033,6 +2057,7 @@ window.onload = function(){
                                                // var _gety = this.kukis[0].miYukkuris[0].getY();
                                                // this.kukis[0].miYukkuris[0].setOldY();
                                                // this.kukis[0].miYukkuris[0].animY(-_y);
+                                               // this.kukis[0].direction = this.direction;
                                        }
                                        // console.log(this.getX() + ":" + this.getY());
                                        this.act();
@@ -2042,7 +2067,8 @@ window.onload = function(){
                                        this.runUnun();
                                        this.runSleep();
                                        this.runAddress();
-                                       this.formSprite.animation();
+                                       this.runAnimation();
+                                       // this.animation();
 
                                }
                        // }catch(e){
@@ -2055,6 +2081,19 @@ window.onload = function(){
                                if(this instanceof Player){
                                        this.formSprite.setFixBudgeRight(5);
                                }
+
+                               this.formSprite.setFixKukiRight();
+                               var len = this.kukis.length;
+                               for(var i=0;i<len;i++){
+                                       var kuki = this.kukis[i];
+                                       var miYukkuris = kuki.getMiYukkuris();
+                                       if(!miYukkuris)continue;
+                                       var miyukkuriLength = miYukkuris.length;
+                                       for(var j=0;j<miyukkuriLength;j++){
+                                               // miYukkuris[j].scaleX = 1;
+                                               // miYukkuris[j].scale(-1, 1);
+                                       }
+                               }
                                // this.formSprite.formScaleY(this.myScale);
 
                                // this.imgBody.scaleX = 1;
@@ -2063,7 +2102,21 @@ window.onload = function(){
                                this.formSprite.formScaleX(-this.myScaleX);
                                if(this instanceof Player){
                                        this.formSprite.setFixBudgeLeft(5);
+                                       this.formSprite.setFixKukiLeft();
+                               }
+                               this.formSprite.setFixKukiLeft();
+                               var len = this.kukis.length;
+                               for(var i=0;i<len;i++){
+                                       var kuki = this.kukis[i];
+                                       var miYukkuris = kuki.getMiYukkuris();
+                                       if(!miYukkuris)continue;
+                                       var miyukkuriLength = miYukkuris.length;
+                                       for(var j=0;j<miyukkuriLength;j++){
+                                               // miYukkuris[j].scaleX = -1;
+                                               // miYukkuris[j].scale(-1, 1);
+                                       }
                                }
+
                                // this.formSprite.formScaleY(this.myScale);
                                // this.imgBody.scaleX = -1;
                        }
@@ -2109,9 +2162,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;
@@ -2185,6 +2240,26 @@ window.onload = function(){
 
                        if(this.param.yukkuri <= 0)this.param.yukkuri = 0;
                        else if(this.param.yukkuri >= this.param.maxYukkuri)this.param.yukkuri = this.param.maxYukkuri;
+
+                       var x = this.getX();
+                       var y = this.getY();
+
+                       var kukiLength = this.kukis.length;
+                       var yukkuris = [];
+                       if(kukiLength > 0){
+                               for(var i=0;i<kukiLength;i++){
+                                       var kuki = this.kukis[i];
+                                       yukkuris = kuki.getMiYukkuris();
+                                       var yukkuriLength = yukkuris.length;
+                                       for(var j=0;j<yukkuriLength;j++){
+                                               var yukkuri = yukkuris[j];
+                                               //TODO ここに方向によってXの値の加算減算をつける
+                                               yukkuri.setX(x - 20);
+                                               yukkuri.setY(y);
+                                       }
+                               }
+
+                       }
                },
                runHungry: function(){
                        if(this.age%50 === 0 && this.age !== 0)this.param.hungry += ADD_HUNGRY;
@@ -2196,7 +2271,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;
                                }
@@ -2271,6 +2346,21 @@ window.onload = function(){
                getUnun: function(){
                        return this.param.unun;
                },
+               getLooksNumber: function(){
+                       return this.param.looks;
+               },
+               getLooksText: function(){
+                       if(this.param.looks == ELooks.GOOD_YUKKURI){
+                               return "びゆん";
+                       }
+                       if(this.param.looks == ELooks.NORMAL_YUKKURI){
+                               return "ぼんゆん";
+                       }
+                       if(this.param.looks == ELooks.BAD_YUKKURI){
+                               return "ぶさゆん";
+                       }
+                       return "";
+               },
                setUnun: function(unun){
                        this.param.unun = unun;
                        if(this.param.unun < 0)this.param.unun = 0;
@@ -2345,7 +2435,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();
@@ -2354,11 +2444,13 @@ window.onload = function(){
                },
                syncDirection:function(senderYukkuri){
                        if(this.getX() > senderYukkuri.getX()){
-                               this.direction = EDirection.LEFT;
-                               senderYukkuri.direction = EDirection.RIGHT;
+                               // this.direction = EDirection.LEFT;
+                               // senderYukkuri.direction = EDirection.RIGHT;
+                               this.setDirection(EDirection.LEFT);
+                               senderYukkuri.setDirection(EDirection.RIGHT);
                        }else{
-                               this.direction = EDirection.RIGHT;
-                               senderYukkuri.direction = EDirection.LEFT;
+                               this.setDirection(EDirection.RIGHT);
+                               senderYukkuri.setDirection(EDirection.LEFT);
                        }
                },
                isCommunication: function(yukkuri){
@@ -2382,6 +2474,7 @@ window.onload = function(){
                        ret += "空腹  " + this.getHungry() + "\n";
                        ret += "うんうん  " + this.getUnun() + "\n";
                        ret += "もちもの  " + this.items.length + "\n";
+                       ret += "容姿  " + this.getLooksText() + "\n";
                        ret += "debug  " + this.action.status + "\n";
                        return ret;
                },
@@ -2461,16 +2554,47 @@ window.onload = function(){
                                //現在の行動パターンから躾対象かセレクトする
                        }
                },
-               addKuki: function(){
-                       for(var i=0;i<this.kukis.length;i++){
-                               if(this.kukis[i].opacity == 0){
-                                       this.kukis[i].opacity = 1.0;
-                                       var miMarisa = new MiMarisa(this.getX(), this.getY());
+               // addKuki: function(){
+                       // for(var i=0;i<this.kukis.length;i++){
+                       //      if(this.kukis[i].opacity == 0){
+                       //              this.kukis[i].opacity = 1.0;
+                       //              // var miMarisa = new MiMarisa(this.getX(), this.getY());
+                       //              var miMarisa = new MiMarisa(100, 100);
                                        
-                                       // console.log(this.imgBody);
-                                       // this.imgBody.addChild(miMarisa);
-                                       this.kukis[i].addMiYukkuri(miMarisa);
-                                       break;
+                       //              // console.log(this.imgBody);
+                       //              // this.imgBody.addChild(miMarisa);
+                       //              this.kukis[i].addMiYukkuri(miMarisa);
+                       //              break;
+                       //      }
+                       // }
+               // },
+               addKuki: function(kuki){
+                       this.kukis.push(kuki);
+                       var length = this.kukis.length;
+                       this.formSprite.addChild(kuki,1000 + length,{type:"kuki",scaleValue:this.myScaleY});
+               },
+               addMiYukkuri: function(index){
+                       var kuki = this.kukis[index];
+                       var miYukkuri = new MiMarisa(this, 10, -30);
+                       // var x = this.getX();
+                       // var y = this.getY();
+                       kuki.addMiYukkuri(miYukkuri);
+
+               },
+               setAutoDirection:function(){
+                       this.direction = this.vx > 0 ? EDirection.RIGHT : EDirection.LEFT;
+               },
+               setDirection: function(direction){
+                       this.direction = direction;
+                       if(this.kukis){
+                               var kukiLength = this.kukis.length
+                               for(var i=0;i<kukiLength;i++){
+                                       var kuki = this.kukis[i];
+                                       var miYukkuris = kuki.getMiYukkuris();
+                                       var miyukkuriLength = miYukkuris.length;
+                                       for(var j=0;j<miyukkuriLength;j++){
+                                               miYukkuris[j].direction = direction;
+                                       }
                                }
                        }
                },
@@ -2478,84 +2602,130 @@ window.onload = function(){
 
                }
        });
-       // var MiYukkuri = enchant.Class.create(Yukkuri,{
-       //      initialize: function(x, y, grow){
-       //              Yukkuri.call(this,x,y, EGrow.FRUIT_BABY);
-       //              this.oldX = x;
-       //              this.oldY = y;
-       //      },
-       //      setOldY: function(){
-       //              this.imgGroup.y = this.oldY;
-
-       //      },
-       //      animX: function(x){
-       //              this.oldX = this.imgGroup.x;
-       //              this.imgGroup.x -= x;
-       //      },
-       //      animY: function(y){
-       //              this.imgGroup.y = this.oldY;
-       //              // this.oldY = this.imgGroup.y;
-       //              this.imgGroup.y -= y;
-       //      }
-       // }); 
-       // var MiMarisa = enchant.Class.create(MiYukkuri,{
-       //      initialize: function(x, y, grow){
-       //              MiYukkuri.call(this,x,y, EGrow.FRUIT_BABY);
-       //              this.classname = "MiMarisa";
-       //              this.myCode = "MIMARISA";
-       //              this.myName = "実まりさ";
-
-       //              this.param = new MarisaParam();
-       //              this.param.range = 0;
-       //              this.param.looks = ELooks.GOOD_YUKKURI;
-
-
-       //              this.face = new enchant.Sprite(64, 64);
-       //              this.face.image = game.assets[EResPath.MARISA_FACE_NORMAL];
-       //              this.face.x = -CHARA_WIDTH / 2;
-       //              this.face.y = -CHARA_HEIGHT / 2;
-
-       //              this.faceStatus ={};
-       //              this.faceStatus[EFace.NORMAL] = EResPath.MARISA_FACE_NORMAL;
-       //              this.faceStatus[EFace.CRY1] = EResPath.MARISA_FACE_CRY1;
-       //              this.faceStatus[EFace.CRY2] = EResPath.MARISA_FACE_CRY2;
-       //              this.faceStatus[EFace.ANGRY] = EResPath.MARISA_FACE_ANGRY;
-       //              this.faceStatus[EFace.HAPPY1] = EResPath.MARISA_FACE_HAPPY1;
-       //              this.faceStatus[EFace.HAPPY2] = EResPath.MARISA_FACE_HAPPY2;
-       //              this.faceStatus[EFace.EAT1] = EResPath.MARISA_FACE_EAT1;
-       //              this.faceStatus[EFace.EAT2] = EResPath.MARISA_FACE_EAT2;
-       //              this.faceStatus[EFace.TIRED] = EResPath.MARISA_FACE_TIRED;
-       //              this.faceStatus[EFace.SLEEP] = EResPath.MARISA_FACE_SLEEP;
-
-       //              this.hear = new enchant.Sprite(64, 64);
-       //              this.hear.image = game.assets[EResPath.MARISA_HEAR];
-       //              this.hear.x = -CHARA_WIDTH / 2;
-       //              this.hear.y = -CHARA_HEIGHT / 2;
-
-       //              this.okazari = new Okazari(this);
-
-
-       //              // this.imgBody.addChild(this);
-       //              // this.imgBody.addChild(this.face);
-       //              // this.imgBody.addChild(this.hear);
-       //              // this.imgBody.addChild(this.okazari);
-       //              this.myScale(this.myScaleX, this.myScaleY)
-       //              // this.imgGroup.width = this.getWidth();
-       //              // this.imgGroup.height = this.getHeight();
-       //              // this.imgGroup.addChild(this.imgBody);
-       //              // this.imgGroup.flgMiYukkuri = true;
-       //              // backgroundMap.addChild(this.imgGroup);
-       //              this._tweet = new TTweet(148, 64);
-
-       //              this.imgGroup.addChild(this._tweet);
-       //              this.imgGroup.x = x;
-       //              this.imgGroup.y = y;
-
-       //              this.action = new Action(this);
-       //              ctl.addObj(this);
-       //      }
-
-       // });
+       var MiYukkuri = enchant.Class.create(ObjSprite, {
+               initialize: function(param){
+                       ObjSprite.call(this,14,14);
+                       // this.oldX = x;
+                       // this.oldY = y;
+
+                       this.classname = "MiYukkuri";
+                       this.image = game.assets[EResPath.MIYUKKURI];
+                       this.x = param.x;
+                       this.y = param.y;
+                       this.addX = param.addX;
+                       this.addY = param.addY;
+                       this.scaleValue = 1;
+                       this.scaleX = 1;
+                       this.scaleY = 1;
+                       backgroundMap.addChild(this);
+                       this.anim = {};
+                       this.anim.cnt = 0;
+
+               },
+               setX : function(x){
+                       this.x = x + this.addX;
+               },
+               setY : function(y){
+                       this.y = y + this.addY;
+               },
+               setOldY: function(){
+                       this.imgGroup.y = this.oldY;
+
+               },
+               animX: function(x){
+                       this.oldX = this.imgGroup.x;
+                       this.imgGroup.x -= x;
+               },
+               animY: function(y){
+                       this.imgGroup.y = this.oldY;
+                       // this.oldY = this.imgGroup.y;
+                       this.imgGroup.y -= y;
+               },
+               scaleX: function(x){
+                       this.scaleX = x;
+               }
+
+       }); 
+       var MiMarisa = enchant.Class.create(MiYukkuri,{
+               initialize: function(parentYukkuri, addX, addY){
+                       var x = parentYukkuri.getX();
+                       var y = parentYukkuri.getY();
+                       if(addX === undefined){
+                               x += addX;
+                       }
+                       if(addY === undefined){
+                               y += addY;
+                       }
+                       MiYukkuri.call(this, {x:x, y:y,addX:addX, addY:addY});
+                       this.classname = "MiMarisa";
+                       this.myCode = "MI_MARISA";
+                       this.myName = "実まりちゃ";
+
+                       // this.classname = "Marisa";
+                       // this.myCode = "MARISA";
+                       // this.myName = "実まりさ";
+
+                       // this.param = new MarisaParam();
+                       // this.param.looks = ELooks.GOOD_YUKKURI;
+                       // this.myName = "実まりちゃ";
+                       // this.param.range /= 4;
+
+                       // this.face = new enchant.Sprite(64, 64);
+                       // this.face.image = game.assets[EResPath.MARISA_FACE_NORMAL];
+                       // this.face.x = -CHARA_WIDTH / 2;
+                       // this.face.y = -CHARA_HEIGHT / 2;
+
+                       // this.faceStatus ={};
+                       // this.faceStatus[EFace.NORMAL] = EResPath.MARISA_FACE_NORMAL;
+                       // this.faceStatus[EFace.CRY1] = EResPath.MARISA_FACE_CRY1;
+                       // this.faceStatus[EFace.CRY2] = EResPath.MARISA_FACE_CRY2;
+                       // this.faceStatus[EFace.ANGRY] = EResPath.MARISA_FACE_ANGRY;
+                       // this.faceStatus[EFace.HAPPY1] = EResPath.MARISA_FACE_HAPPY1;
+                       // this.faceStatus[EFace.HAPPY2] = EResPath.MARISA_FACE_HAPPY2;
+                       // this.faceStatus[EFace.EAT1] = EResPath.MARISA_FACE_EAT1;
+                       // this.faceStatus[EFace.EAT2] = EResPath.MARISA_FACE_EAT2;
+                       // this.faceStatus[EFace.TIRED] = EResPath.MARISA_FACE_TIRED;
+                       // this.faceStatus[EFace.SLEEP] = EResPath.MARISA_FACE_SLEEP;
+
+
+                       // this.hear = new enchant.Sprite(64, 64);
+                       // this.hear.image = game.assets[EResPath.MARISA_HEAR];
+                       // this.hear.x = -CHARA_WIDTH / 2;
+                       // this.hear.y = -CHARA_HEIGHT / 2;
+
+                       // this.okazari = new Okazari(this);
+
+                       // this._tweet = new TTweet(this, 148, 64);
+
+                       // 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});
+                       // this.formSprite.addChild(this._tweet,6,{type:"tweet",scaleValue:this.myScaleY});
+                       // this.myScale(this.myScaleX, this.myScaleY)
+                       // if(this instanceof Player){
+                       //      this.budge = new enchant.Sprite(16, 16);
+                       //      this.budge.image = game.assets[EResPath.PLAYER_BADGE];
+                       //      this.budge.x = -this.getWidth()/2;
+                       //      this.budge.y = -this.getHeight()/2;
+                       //      this.budge.scale(this.myScaleX, this.myScaleY);
+                       //      this.formSprite.addChild(this.budge,5, {type:"budge",scaleValue:this.myScaleY});
+                       //      this.formSprite.setX(x);
+                       //      this.formSprite.setY(y);
+                       // }
+                       // this.formSprite.setX(x);
+                       // this.formSprite.setY(y);
+                       // this.animation();
+                       // this.action = new Action(this);
+                       // ctl.addObj(this);
+               }
+
+       });
        var Marisa = enchant.Class.create(Yukkuri,{
                initialize: function(x, y, grow){
                        Yukkuri.call(this,x,y, grow);
@@ -2613,28 +2783,26 @@ window.onload = function(){
 
                        this.kukis = [];
                        this.kukis[0] = new Kuki(this, 0, 0);
-                       this.kukis[1] = new Kuki(this, 10, 0);
-                       this.kukis[2] = new Kuki(this, 5, 5);
-                       this.kukis[3] = new Kuki(this, -5, 5);
+                       // this.kukis[1] = new Kuki(this, 10, 0);
+                       // this.kukis[2] = new Kuki(this, 5, 5);
+                       // 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",
                                scaleValue:this.myScaleY
                        });
-                       // this.formSprite.add(this.face,2,{type:"body",scaleValue:this.myScaleY});
-                       // this.formSprite.add(this.hear,3,{type:"body",scaleValue:this.myScaleY});
-                       // this.formSprite.add(this.okazari,4,{type:"body",scaleValue:this.myScaleY});
-                       // this.formSprite.add(this._tweet,6,{type:"tweet",scaleValue:this.myScaleY});
-                       // this.formSprite.addChildAll();
+
                        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});
                        this.formSprite.addChild(this._tweet,6,{type:"tweet",scaleValue:this.myScaleY});
-                       // this.formSprite.addChildAll();
+                       this.formSprite.addChild(this.kukis[0],7,{type:"kuki",scaleValue:this.myScaleY});
+
 
+                       // this.formSprite.addChildAll();
                        // App.backgroundMap.addChild(this._tweet);
                        // this.imgGroup.addChild(this.shadow);
                        // this.imgBody.addChild(this);
@@ -2694,15 +2862,15 @@ window.onload = function(){
                                //Action pattern  debug
                                if(game.input.left){
                                        // this.changeFace(EResPath.MARISA_FACE_TIRED);
-                                       this.moveX(-10);
+                                       // this.moveX(-10);
                                        this.direction = EDirection.LEFT;
                                }
                                if(game.input.right){
-                                       for(var i=0;i<this.formSprite.spriteArray.length;i++){
-                                               var spr = this.formSprite.spriteArray[i];
-                                               console.log(i+":spry:" + spr.y);
-                                       }
-                                       this.moveX(10);
+                                       // for(var i=0;i<this.formSprite.spriteArray.length;i++){
+                                       //      var spr = this.formSprite.spriteArray[i];
+                                       //      console.log(i+":spry:" + spr.y);
+                                       // }
+                                       // this.moveX(10);
                                        this.direction = EDirection.RIGHT;
                                }
                                if(game.input.up){
@@ -2796,14 +2964,9 @@ window.onload = function(){
                        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._tweet = new TTweet(this, 148, 64);
+                       this.formSprite.addChild(this._tweet,6,{type:"tweet",scaleValue:this.myScaleY});
 
-                       // this.imgGroup.addChild(this.shadow);
-                       // this.imgBody.addChild(this.okazari);
-                       // this.imgBody.addChild(this);
-                       // this.imgBody.addChild(this.face);
-                       // this.imgBody.addChild(this.hear);
-                       // this.imgBody.addChild(this.sub1);
                        this.myScale(this.myScaleX, this.myScaleY)
                        if(this instanceof Player){
                                this.budge = new enchant.Sprite(16, 16);
@@ -2813,17 +2976,6 @@ window.onload = function(){
                                this.budge.y -= this.getHeight()/2;
                                this.budge.scale(this.myScaleX, this.myScaleX);
                        }
-                       // this.imgGroup.width = this.getWidth();
-                       // this.imgGroup.height = this.getHeight();
-                       // this.imgGroup.addChild(this.imgBody);
-                       // backgroundMap.addChild(this.imgGroup);
-                       this._tweet = new TTweet(this, 148, 64);
-                       backgroundMap.addChild(this._tweet);
-
-
-                       // this.imgGroup.addChild(this._tweet);
-                       // this.imgGroup.x = x;
-                       // this.imgGroup.y = y;
 
                        this.formSprite.setX(x);
                        this.formSprite.setY(y);
@@ -2892,16 +3044,23 @@ window.onload = function(){
                // var food = new def.Food("apple", 200, 250);
                backgroundMap.addChild(foodGroup);
                // backgroundMap.addChild(placeGroup);
+               // var mimarisa = new MiMarisa(PALYER_INIT_X + 100, PALYER_INIT_Y + 100, EGrow.FRUIT_BABY);
                var player = new Player(PALYER_INIT_X + 200, PALYER_INIT_Y + 200, EGrow.ADULT);
+               ;
+               player.addMiYukkuri(0);
                // var player = new Player(0, 0);
                // console.log(player.getX());
                // player.addKuki();
+               // player.addMiYukkuri(mimarisa)
                // player.createKuki();
-               // new Marisa(PALYER_INIT_X + 50, PALYER_INIT_Y + 200, EGrow.ADULT);
+               new Marisa(PALYER_INIT_X + 50, PALYER_INIT_Y + 200, EGrow.ADULT);
+               
+               // new Marisa(PALYER_INIT_X + 150, PALYER_INIT_Y + 200, EGrow.ADULT);
+               // new Marisa(PALYER_INIT_X + 250, PALYER_INIT_Y + 200, EGrow.ADULT);
                // 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 + 100, PALYER_INIT_Y + 100, 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);