OSDN Git Service

実ゆっくりに向きを追加。次回は左向きのときの座標あわせを行う。TODO要確認
[yukkurioverwint/YukkuriOverwinter.git] / main.js
diff --git a/main.js b/main.js
index 222420e..04b6f62 100644 (file)
--- a/main.js
+++ b/main.js
@@ -26,20 +26,25 @@ var net = new Net();
 //////////////////////////////////////
 //define
 //////////////////////////////////////
+var ADD_HUNGRY = 1;
 var PALYER_INIT_X = 100;
 var PALYER_INIT_Y = 100;
 var CHARA_WIDTH = 64;
 var CHARA_HEIGHT = 64;
 var GAME_WIDTH = 800;
 var GAME_HEIGHT = 600;
-var FPS = 50;
+var FPS = 40;
 var BASE_FPS = 20;
 var HUNGRY_MAX = 100;
+var TIME_SPEED = 4;
 var MIN = BASE_FPS;
 var HOUR = MIN * 60;
 // var DAY = HOUR * 24;
 var DAY = HOUR ;
 var GAME_START_TIME = HOUR * 6;
+//48x48 best?
+var ICON_WIDTH = 48;
+var ICON_HEIGHT = 48;
 
 var EResPath = {
        YUKKURI_BASE : './data/yukkuri_base.png',
@@ -57,13 +62,15 @@ var EResPath = {
        MARISA_FACE_HAPPY2 : './data/marisa/face_happy2.png',
        MARISA_FACE_SLEEP : './data/marisa/face_sleep1.png',
        MARISA_HEAR : './data/marisa/hear1.png',
+       MARISA_OKAZARI : './data/marisa/okazari.png',
        OBJECT : './data/object.png',
        MAP0 : './data/map0.png',
        COMMAND : './data/command.png',
-       OKAZARI : './data/okazari.png',
        PLACE_TREE : './data/system/place_tree.png',
        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 = {
@@ -108,6 +115,8 @@ var ECommand = {
        WORLD_TARGET: 1,
        WORLD_APPLE: 2,
        WORLD_PLACE: 3,
+       WORLD_REMOVE: 4,
+       WORLD_PICOPICO_HUMMER: 5,
 };
 
 var EMenuPos = {
@@ -116,6 +125,7 @@ var EMenuPos = {
        WIDTH : 200,
        HEIGHT : GAME_HEIGHT,
 };
+//width:200px;
 var EFieldPos = {
        X : 0,
        Y : 0,
@@ -154,6 +164,9 @@ var EAction = {
        EAT_IN_HOME: 31,
        NONE: 9999
 };
+var EDeepSay = {
+
+}
 var EDirection = {
        LEFT : 0,
        RIGHT: 1,
@@ -177,6 +190,13 @@ var EMsg = {
        HUNT_ESCAPE: 15,
        YYUYYU: 16,
        MOVE_GOTO_HOME:17,
+       HUNTING_MESSAGE:18,
+       LEARN_NO_FOOD_IN_PLACE:19,
+       REMOVE_YUKKURI:20,
+       LOST_HOUSE:21,
+       MOVE_TO_HUNTING:22,
+       DAMAGE:23,
+
 };
 var EWalkAnimation = {
        START: 0,
@@ -187,6 +207,7 @@ var EGrow = {
        SUBADULT : 1,
        CHILD : 2,
        BABY : 3,
+       FRUIT_BABY : 4,
 };
 var EDate = {
        MORNING : 0,
@@ -207,18 +228,38 @@ var EFood = {
        NORMAL : 1,
        GREAT : 2
 };
+var EExSkill = {
+       NO_FOOD_IN_PLACE : 1,
+       KEKKAI : 2,
+};
+var EMemory = {
+       FOOD_IN_PLACE : 1,
+};
+var EDamage = {
+       PICOHAN : 1
+};
+var ELooks = {
+       GOOD_YUKKURI : 3,
+       NORMAL_YUKKURI : 2,
+       BAD_YUKKURI : 1,
+};
+var EAnimStatus = {
+       UP : 0,
+       DOWN : 1,
+};
+include("./lib/Animation.js"); 
+include("./lib/FormSprite.js"); 
+include("./lib/Util.js"); 
+
+
 var ObjSprite = enchant.Class.create(enchant.Sprite,{
        initialize: function (w, h){
                enchant.Sprite.call(this, w, h);
                this.id = guid();
                ctl.addObj(this);
-
-
                                // // new BoxLabel(this.ctl,100, e.x, e.y);
                                // var box = new Box(this.ctl, 200, 200);
-
                                // box.text("テスト\naaaaaa\nfffffffff\nテスト\naaaaaa\nfffffffff\nテスト\naaaaaa\n", e.x, e.y);
-
        },
        getStatusForDisplay: function (){
                return "";
@@ -235,9 +276,20 @@ var ObjSprite = enchant.Class.create(enchant.Sprite,{
        getHeight: function(){
                return this.height;
        },
+       isWorld: function(){
+               return (this.id !== null && this.id !== undefined);
+       },
        removeAll: function(){
                this.remove();
                ctl.removeObj(this);
+               this.id = null;
+       },
+       undefineAll: function (){
+               for(var key in this){
+                       // if(this.hasOwnProperty(key)){
+                               delete this[key];
+                       // }
+               }
        }
 });
 
@@ -290,6 +342,60 @@ window.onload = function(){
                if(b instanceof Box){
                        return -1;
                }
+               var budgeValue = 10 + 28;
+               var shadowValue = -28;
+               //okazariは他のbodyと比べて11低い
+               var okazariValue = 37 + 11;
+               var okazariReimuValue = 32;
+               var bodyValue = 37;
+               var tweetValue = 288;
+               var kukiValue = 143;
+               var miYukkuriValue = 363;
+
+               if(a.type == "shadow"){
+                       ay += shadowValue * a.scaleValue;
+               }
+               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;
+               }
+               else if(a.type == "tweet"){
+                       ay += tweetValue * a.scaleValue;
+               }
+               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;
+               }
+               else if(b.type == "body" && b.classname == "Okazari"){
+                       by += okazariValue * b.scaleValue - b.anim.cnt;
+               }
+               else if(b.type == "body"){
+                       by += bodyValue * b.scaleValue - b.anim.cnt;
+               }
+               else if(b.type == "tweet"){
+                       by += tweetValue * b.scaleValue;
+               }
+               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){
                        ay = a.y;
                        ay += a.height/2;
@@ -298,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);
@@ -305,9 +418,15 @@ window.onload = function(){
                if(b instanceof Place){
                        by += Math.round(b.height * 0.7);
                }
+               // if(a.flgMiYukkuri){
+               //      ay += CHARA_HEIGHT;
+               // }
+               // if(b.flgMiYukkuri){
+               //      by += CHARA_HEIGHT;
+               // }
 
-               if(ay < by)return -1;
-               else if(ay > by)return 1;
+               if(Math.round(ay) < Math.round(by))return -1;
+               else if(Math.round(ay) > Math.round(by))return 1;
                if(a.id < b.id)return -1;
                else if(a.id > b.id)return 1;
                return 0;
@@ -318,10 +437,11 @@ window.onload = function(){
        var def = new Object();
        var foodGroup = new Group();
        var SpriteGroup = enchant.Class.mixClasses(Sprite, Group,true);
+       SpriteGroup.prototype.classname = "";
        var menuBg = new SpriteGroup(EMenuPos.WIDTH, EMenuPos.HEIGHT);
        var fieldBg = new enchant.Sprite(EFieldPos.WIDTH, EFieldPos.HEIGHT);
        var windowFront = new enchant.Sprite(EFieldPos.WIDTH, EFieldPos.HEIGHT);
-       var game = new Game(GAME_WIDTH, GAME_HEIGHT);
+       game = new Game(GAME_WIDTH, GAME_HEIGHT);
        game.fps = FPS;
        var _loadArr = [];
        var i=0;
@@ -342,6 +462,7 @@ window.onload = function(){
        game.preload(_loadArr);
        var MapGroup = enchant.Class.mixClasses(Map, Group,true);
        var backgroundMap = new MapGroup(16, 16);
+       App.backgroundMap = backgroundMap;
        include("./class.js");
        include("./ctrl.js");
        ctl = new Ctrl();
@@ -370,7 +491,6 @@ window.onload = function(){
 
                },
                act : function(){
-
                        this.observe();
                        switch(this.status){
                                case EAction.WAIT:
@@ -434,8 +554,15 @@ window.onload = function(){
                                        this.communicate_start();
                                break;
                                case EAction.COMMUNICATE_WAIT:
-                               break;
                                case EAction.COMMUNICATE_RECV:
+                               if(this.yukkuri.communicateYukkuri != null){
+                                       var _s = this.yukkuri.communicateYukkuri.action.getStatus();
+                                       if(this.yukkuri.communicateYukkuri.isDead()
+                                               || (_s !== EAction.COMMUNICATE_START && _s !== EAction.COMMUNICATE_WAIT && _s !== EAction.COMMUNICATE_RECV)){
+                                               this.setStatus(EAction.THINK);
+                                               this.yukkuri.animation();
+                                       }
+                               }
                                break;
                                case EAction.MOVE_TO_PLACE_START_HOMELESS:
                                        this.move_to_place_start_homeless();
@@ -459,48 +586,50 @@ window.onload = function(){
                        }
                        this.yukkuri.reverse();
                },
-               thinkHavePlace: function(){
-                       var date = ctl.getDate();
-                       if(this.yukkuri.isPlaceRange()){
-                       }else{
-                               //ゆっくりプレイスの範囲外
-                               if(date === EDate.EVENING
-                                       || date === EDate.NIGHT
-                                       || date === EDate.MIDNIGHT
-                                       ){
-                                       this.setStatus(EAction.MOVE_GOTO_HOME);
-                                       return;
-                               }
-                               else if(date === EDate.EVENING){
-                                       // if(this.yukkuri.isItemsMax()){
-                                       //      this.setStatus(EAction.IN_HOME);
-                                       // }
-                                       // else{
-                                       //      this.setStatus(EAction.MOVE_TO_HUNT_START);
-                                       // }
-                               }
-                       }
-                       if(this.yukkuri.isVeryKuhuku()){
-                               //食べ物探したい
-                               //なかったら
-                               this.setStatus(EAction.MOVE_GOTO_HOME);
-                       }
-                       else if(this.yukkuri.isSleep()){
-                               this.setStatus(EAction.SLEEP_START);
-                       }
-                       else if(this.yukkuri.getUnun() >= 80){
-                               this.setStatus(EAction.UNUN_START);
-                       }
-                       else{
-                               this.yukkuri.changeFace();
-                               this.search();
-                       }
-               },
+               // thinkHavePlace: function(){
+               //      var date = ctl.getDate();
+               //      if(this.yukkuri.isPlaceRange()){
+               //      }else{
+               //              //ゆっくりプレイスの範囲外
+               //              if(date === EDate.EVENING
+               //                      || date === EDate.NIGHT
+               //                      || date === EDate.MIDNIGHT
+               //                      ){
+               //                      this.setStatus(EAction.MOVE_GOTO_HOME);
+               //                      return;
+               //              }
+               //              else if(date === EDate.EVENING){
+               //                      // if(this.yukkuri.isItemsMax()){
+               //                      //      this.setStatus(EAction.IN_HOME);
+               //                      // }
+               //                      // else{
+               //                      //      this.setStatus(EAction.MOVE_TO_HUNT_START);
+               //                      // }
+               //              }
+               //      }
+               //      if(this.yukkuri.isVeryKuhuku()){
+               //              //食べ物探したい
+
+               //              //なかったら
+               //              this.setStatus(EAction.MOVE_GOTO_HOME);
+               //      }
+               //      else if(this.yukkuri.isSleep()){
+               //              this.setStatus(EAction.SLEEP_START);
+               //      }
+               //      else if(this.yukkuri.getUnun() >= 80){
+               //              this.setStatus(EAction.UNUN_START);
+               //      }
+               //      else{
+               //              this.yukkuri.changeFace();
+               //              this.search();
+               //      }
+               // },
                think_in_home: function(){
                        var date = ctl.getDate();
-                       if((date === EDate.MIDNIGHT || date === EDate.NIGHT)
-                               && !this.yukkuri.isSleep()){
-                               //sleep
+                       if((date === EDate.MIDNIGHT)
+                               && !this.yukkuri.isSleep()
+                               && !this.yukkuri.isVeryKuhuku()
+                               ){
                                new SleepEvent({
                                        "action": this,
                                        "nextStatus":EAction.THINK_IN_HOME,
@@ -511,6 +640,9 @@ window.onload = function(){
                        else if(date === EDate.EVENING){
                                //QK
                        }
+                       else if(this.yukkuri.isVeryKuhuku() && this.yukkuri.getPlace().isFood()){
+                               this.setStatus(EAction.EAT_IN_HOME);
+                       }
                        else{
                                //marisa is hunting move
                                if(this.yukkuri.beforeHuntingFood !== null){
@@ -551,7 +683,8 @@ window.onload = function(){
                                console.log("retryCount over");
                                return;
                        }
-                       if(this.yukkuri.imgGroup.tl.queue.length === 0){
+                       if(this.yukkuri.formSprite.tlQueueLength() === 0){
+                       // if(this.yukkuri.imgGroup.tl.queue.length === 0){
                                var frame = 200;
                                frame += plusFrameScale(frame, this.yukkuri.getMyScale());
                                if(this.isMoving){
@@ -562,24 +695,29 @@ window.onload = function(){
                                }else{
                                        var xpos = 150 + rand(40) - (retryCounter * 10);
                                        var ypos = 150 + rand(40) - (retryCounter * 10);
-                                       if(rand(8) === 0){
+                                       if(false){
+                                               this.yukkuri.vx = xpos;
+                                               this.yukkuri.vy = ypos;
+                                               this.yukkuri.setDirection(EDirection.RIGHT);
+                                       }
+                                       else if(rand(8) === 0){
                                                this.yukkuri.vx = 0;
                                                this.yukkuri.vy = -ypos;
                                        }
                                        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;
@@ -588,26 +726,26 @@ 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;
                                                // var x = this.yukkuri.x + (this.yukkuri.moveX ? this.yukkuri.moveX / Math.abs(this.yukkuri.moveX) * 16 : 0) + 16;
                                                // var y = this.yukkuri.y + (this.yukkuri.moveY ? this.yukkuri.moveY / Math.abs(this.yukkuri.moveY) * 16 : 0) + 16;
-                                               var x = this.yukkuri.imgGroup.x + this.yukkuri.vx;
-                                               var y = this.yukkuri.imgGroup.y + this.yukkuri.vy + this.yukkuri.height / 2;
+                                               var x = this.yukkuri.getX() + this.yukkuri.vx;
+                                               var y = this.yukkuri.getY() + this.yukkuri.vy + this.yukkuri.getHeight() / 2;
                                                if (0 <= x && x < map.width && 0 <= y && y < map.height && !map.hitTest(x, y)) {
-                                                       // console.log("あたってないよ:"+ this.yukkuri.imgGroup.x + ":" + this.yukkuri.imgGroup.y);
+                                                       // console.log("あたってないよ:"+ this.yukkuri.getX() + ":" + this.yukkuri.getY());
                                                        // console.log("X:" + this.yukkuri.moveX);
                                                        // console.log("Y:" + this.yukkuri.moveY);
                                                        this.isMoving = true;
@@ -617,7 +755,7 @@ window.onload = function(){
                                                        //うんうんくさい対策
                                                        this.targetNode = null;
                                                }else{
-                                                       // console.log("HIT:"+ this.yukkuri.imgGroup.x + ":" + this.yukkuri.imgGroup.y);
+                                                       // console.log("HIT:"+ this.yukkuri.getX() + ":" + this.yukkuri.getY() + "," + this.yukkuri.vx + ":" + this.yukkuri.vy);
                                                        this.walk(retryCounter+1);
                                                }
                                        }
@@ -705,14 +843,33 @@ window.onload = function(){
                },
                in_home:function(){
                        var place = this.yukkuri.getPlace();
-                       new InHomeEvent({
-                               "type": 'hunt_end',
-                               "targetNode": place,
+                       if(place != null && place.isWorld()){
+                               new InHomeEvent({
+                                       "type": 'hunt_end',
+                                       "targetNode": place,
+                                       "action": this,
+                                       "myYukkuri": this.yukkuri
+                               });
+                       }else{
+                               if(place && !place.isWorld())place.undefineAll();
+                               this.yukkuri.declarePlace(null);
+                               this.setStatus(EAction.WAIT);
+                               mangMsg.output(this.yukkuri, EMsg.LOST_HOUSE);
+                               this.yukkuri.setFaceImage(EFace.CRY2);
+                               new WaitEvent({
+                                       "waitframe": FPS * 3.0,
+                                       "action": this,
+                                       "myYukkuri": this.yukkuri
+                               });
+                       }
+               },
+               move_to_command: function(){
+                       var obj = this.yukkuri.searchObjectMang.currentCmdObject;
+                       new MoveToCommandEvent({
                                "action": this,
+                               "cmdObject": obj,
                                "myYukkuri": this.yukkuri
                        });
-               },
-               move_to_command: function(){
 
                },
                search: function(){
@@ -720,9 +877,9 @@ window.onload = function(){
                        var nodes = ctl.getObjs();
                        l = nodes.length;
                        var ununFlg = false;
-
                        for (var key in nodes) {
                                var node = nodes[key];
+                               if(node === null || node === undefined)continue;
                                if(this.yukkuri.id === node.id)continue;
                                //うんうん臭いを検索
                                if (
@@ -740,12 +897,14 @@ window.onload = function(){
                                }
                                //ゆっくりを検索
                                else if(node instanceof Yukkuri){
-                                       if(this.yukkuri.within(node, this.yukkuri.getRange())){
+                                       if(node.grow != EGrow.FRUIT_BABY && this.yukkuri.within(node, this.yukkuri.getRange())){
                                                this.yukkuri.addSearchObject(ESearch.YUKKURI, node);
                                        }
                                }
                                //ゆっくりプレイスを検索
                                else if(node instanceof Place){
+                                       if(this.yukkuri instanceof Player){
+                                       }
                                        if(this.yukkuri.within(node, this.yukkuri.getRange())){
                                                this.yukkuri.addSearchObject(ESearch.PLACE, node);
                                        }
@@ -763,6 +922,7 @@ window.onload = function(){
        var SearchObjectMang = enchant.Class.create({
                initialize: function (){
                        this.init();
+                       this.currentCmdObject = null;
                },
                init:function(){
                        this.datas = [];
@@ -800,6 +960,20 @@ window.onload = function(){
                        return ret;
                },
                callEvent: function(yukkuri){
+                       if(yukkuri.cmdQueue.length !== 0){
+                               this.currentCmdObject = yukkuri.cmdQueue.shift();
+                               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();
                                yukkuri.action.setStatus(EAction.MOVE_GOTO_HOME);
@@ -808,12 +982,7 @@ window.onload = function(){
                        if(yukkuri.isVeryKuhuku()){
                                //エサを探す
                                var foods = this.get(ESearch.FOOD);
-                               if(foods.length === 0 && yukkuri.isPlace()){
-                                       //家があるなら家に帰宅
-                                       yukkuri.action.targetNode = yukkuri.getPlace();
-                                       yukkuri.action.setStatus(EAction.MOVE_GOTO_HOME);
-                                       return;
-                               }else{
+                               if(foods.length > 0){
                                        var foods = this.get(ESearch.FOOD);
                                        food = this.getNear(ESearch.FOOD, yukkuri);
                                        if(food !== null){
@@ -822,17 +991,22 @@ window.onload = function(){
                                                return;
                                        }
                                }
-                       }
+                               if(yukkuri.getMemory(EMemory.FOOD_IN_PLACE) === 0 && yukkuri.getExSkill(EExSkill.NO_FOOD_IN_PLACE) >= 1){
+                                       yukkuri.action.setStatus(EAction.WALK);
+                                       return;
+                               }
 
-                       if(yukkuri.isSleep()){
-                               yukkuri.action.setStatus(EAction.SLEEP_START);
+                               //家があるなら家に帰宅
+                               if(foods.length === 0 && yukkuri.isPlace() && yukkuri.getPlace().isFood()){
+                                       yukkuri.action.targetNode = yukkuri.getPlace();
+                                       yukkuri.action.setStatus(EAction.MOVE_GOTO_HOME);
+                                       return;
+                               }
+                               //たべものを探しに行く
+                               yukkuri.action.setStatus(EAction.WALK);
                                return;
                        }
 
-                       else if(yukkuri.getUnun() >= 80){
-                               yukkuri.action.setStatus(EAction.UNUN_START);
-                               return;
-                       }
 
 
                        if(!yukkuri.isItemsMax() && yukkuri.isPlace()){
@@ -873,9 +1047,10 @@ window.onload = function(){
                        this.guid = guid();
                },
                onactionstart:function(self){
-                       return function(e){
-                               if(typeof e === "undefined")return;
-                       };
+                       return this._onactionstart;
+               },
+               _onactionstart:function(e){
+                       if(typeof e === "undefined")return;
                },
                onactiontick:function(self){
                        return function(e){
@@ -1017,7 +1192,6 @@ window.onload = function(){
                        this.action = _data.action;
                        this.action.setStatus(EAction.EAT_WAIT);
 
-
                        var sec = BASE_FPS * 3;
                        if(this.yukkuri.eat(this.food)){
                                mangMsg.output(this.yukkuri, EMsg.EAT);
@@ -1034,7 +1208,7 @@ window.onload = function(){
                onactionend:function(self){
                        return function(e){
                                if(typeof e === "undefined")return;
-                               if(self.food == null || self.food.getAmount() <= 0 || self.yukkuri.isManpuku()){
+                               if(self.food == null || self.food.getAmount() <= 0 || self.yukkuri.isManpuku() || !self.food.isWorld()){
                                        self.action.setStatus(EAction.THINK);
                                        self.yukkuri.setFaceImage(EFace.NORMAL);
                                }else{
@@ -1063,27 +1237,21 @@ window.onload = function(){
                        //food distance
                        if(this.data.type == "food"){
                                this.action.status = EAction.MOVE_TO_EAT_UNDERWAY;
-                               yukkuri.vx = node.x - yukkuri.getX() + node.width / 2;
-                               yukkuri.vy = node.y - yukkuri.getY() - yukkuri.getHeight() / 2 + node.height / 2;
+                               yukkuri.vx = node.x - yukkuri.getX() + node.width / 2 + yukkuri.getWidth() / 2;
+                               yukkuri.vy = node.y - yukkuri.getY() - yukkuri.getHeight() / 2 + node.height / 2 + yukkuri.getHeight() / 2;
                                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);
 
                                yukkuri.moveBy(yukkuri.vx, yukkuri.vy, frame, {
-                                       "onactionstart": this.onactionstart(this),
                                        "onactiontick": this.onactiontick(this),
                                        "onactionend": this.onactionend(this)
                                });
                        }
                },
-               onactionstart:function(self){
-                       return function(e){
-                               if(typeof e === "undefined")return;
-                               mangMsg.output(self.yukkuri, EMsg.TARGETING_EAT);
-                       };
-               },
                onactiontick:function(self){
                        return function(e){
                                if(typeof e === "undefined")return;
@@ -1113,14 +1281,14 @@ window.onload = function(){
                        //food distance
                        if(this.data.type == "food"){
                                this.action.setStatus(EAction.WAIT);
-                               yukkuri.vx = nodeX - yukkuri.getX() + nodeWidth / 2;
-                               yukkuri.vy = nodeY - yukkuri.getY() - yukkuri.getHeight() / 2 + nodeHeight / 2;
+                               yukkuri.vx = nodeX - yukkuri.getX() + yukkuri.getWidth() / 2;
+                               yukkuri.vy = nodeY - yukkuri.getY() - yukkuri.getHeight() / 2 + nodeHeight / 2 + yukkuri.getHeight() / 2;
                                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);
+                               mangMsg.output(yukkuri, EMsg.MOVE_TO_HUNTING);
 
                                yukkuri.moveBy(yukkuri.vx, yukkuri.vy, frame, {
                                        "onactionend": this.onactionend(this)
@@ -1145,24 +1313,34 @@ window.onload = function(){
                        this.action.setStatus(EAction.WAIT);
                        this.huntingStatus = "hunting";
                        this.tick = 0;
-                       this.yukkuri.beforeHuntingFood = this.food;
-                       var sec = BASE_FPS * 8;
-                       if(this.yukkuri.hunt(this.food)){
-                               this.huntingStatus = "hunting";
-                               mangMsg.output(this.yukkuri, EMsg.HUNT);
-                               this.yukkuri.setFaceImage(EFace.HAPPY1);
-                       }else{
-                               if(this.yukkuri.isItemsMax()){
-                                       sec = 1;
-                                       this.huntingStatus = "return";
-                                       // mangMsg.output(this.yukkuri, EMsg.REHUNT);
-                                       this.yukkuri.setFaceImage(EFace.NORMAL);
+                       // this.yukkuri.beforeHuntingFood = this.food;
+                       if(this.food.isWorld()){
+                               this.yukkuri.beforeHuntingFood = new MemoryFood(this.food);
+                               var sec = BASE_FPS * 8;
+                               if(this.yukkuri.hunt(this.food)){
+                                       this.huntingStatus = "hunting";
+                                       mangMsg.output(this.yukkuri, EMsg.HUNTING_MESSAGE);
+                                       this.yukkuri.setFaceImage(EFace.HAPPY1);
                                }else{
-                                       sec = BASE_FPS * 3;
-                                       this.huntingStatus = "cry";
-                                       mangMsg.output(this.yukkuri, EMsg.EAT_FAILED);
-                                       this.yukkuri.setFaceImage(EFace.CRY2);
+                                       if(this.yukkuri.isItemsMax()){
+                                               sec = 1;
+                                               this.huntingStatus = "return";
+                                               // mangMsg.output(this.yukkuri, EMsg.REHUNT);
+                                               this.yukkuri.setFaceImage(EFace.NORMAL);
+                                       }else{
+                                               sec = BASE_FPS * 3;
+                                               this.huntingStatus = "cry";
+                                               mangMsg.output(this.yukkuri, EMsg.EAT_FAILED);
+                                               this.yukkuri.setFaceImage(EFace.CRY2);
+                                       }
                                }
+
+                       }else{
+                               this.yukkuri.beforeHuntingFood = null;
+                               sec = BASE_FPS * 3;
+                               this.huntingStatus = "cry";
+                               mangMsg.output(this.yukkuri, EMsg.EAT_FAILED);
+                               this.yukkuri.setFaceImage(EFace.CRY2);
                        }
 
                        this.yukkuri.wait(sec, {
@@ -1174,9 +1352,10 @@ window.onload = function(){
                        return function(e){
                                if(typeof e === "undefined")return;
                                self.tick++;
-                               if(self.huntingStatus == "hunting" && self.tick > BASE_FPS * 2){
-                                       if(this.age%(BASE_FPS * 3) == 0){
-                                               mangMsg.output(self.yukkuri, EMsg.YYUYYU)
+                               if(self.huntingStatus == "hunting" && self.tick > BASE_FPS * 1){
+                                       if(this.age%(BASE_FPS * 5) == 0){
+                                               // mangMsg.output(self.yukkuri, EMsg.YYUYYU)
+                                               mangMsg.output(self.yukkuri, EMsg.HUNTING_MESSAGE);
                                        }
                                }
                        };
@@ -1196,7 +1375,8 @@ window.onload = function(){
                                        self.action.setStatus(EAction.MOVE_GOTO_HOME);
                                }
                                else if(self.huntingStatus === "cry"){
-                                       self.action.setStatus(EAction.THINK);
+                                       // self.action.setStatus(EAction.THINK);
+                                       self.action.setStatus(EAction.WALK);
                                }
                                self.release();
                        };
@@ -1221,16 +1401,11 @@ window.onload = function(){
                                this.action.setStatus(EAction.WAIT);
                                yukkuri.vx = place.x - yukkuri.getX() + place.width / 2;
                                yukkuri.vy = place.y - yukkuri.getY() - yukkuri.getHeight() / 2 + place.height;
-                               // console.log("place.x:" + place.x);
-                               // console.log("place.y:" + place.y);
-                               // console.log("yukkuri.getX():" + yukkuri.getX());
-                               // console.log("yukkuri.getY():" + yukkuri.getY());
-                               // console.log("yukkuri.vx:" + yukkuri.vx);
-                               // console.log("yukkuri.vy:" + yukkuri.vy);
                                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)
 
@@ -1269,12 +1444,24 @@ window.onload = function(){
 
                        var yukkuri = this.yukkuri;
                        var place = this.data.targetNode;
+
                        if(yukkuri.isVeryKuhuku()){
                                if(place.isFood()){
+                                       yukkuri.setMemory(EMemory.FOOD_IN_PLACE, 1);
                                        this.action.setStatus(EAction.EAT_IN_HOME);
                                        return;
                                }else{
-                                       mangMsg.output(yukkuri, EMsg.EAT_FAILED);
+                                       yukkuri.setMemory(EMemory.FOOD_IN_PLACE, 0);
+                                       //experience skill
+                                       if(yukkuri.getExSkill(EExSkill.NO_FOOD_IN_PLACE) >= 1){
+                                               mangMsg.output(yukkuri, EMsg.LEARN_NO_FOOD_IN_PLACE);
+                                               this.action.setStatus(EAction.THINK);
+                                               return;
+                                       }else{
+                                               mangMsg.output(yukkuri, EMsg.EAT_FAILED);
+                                               yukkuri.addExValue(EExSkill.NO_FOOD_IN_PLACE, 50);
+                                       }
+
                                }
                        }
                        this.action.setStatus(EAction.WAIT);
@@ -1285,6 +1472,7 @@ window.onload = function(){
 
                        }
                        var sec = BASE_FPS * 10;
+                       if(place.isFood())yukkuri.setMemory(EMemory.FOOD_IN_PLACE, 1);
                        this.yukkuri.wait(sec, {
                                "onactiontick": this.onactiontick(this),
                                "onactionend": this.onactionend(this)
@@ -1301,7 +1489,7 @@ window.onload = function(){
                onactionend:function(self){
                        return function(e){
                                if(typeof e === "undefined")return;
-                               self.action.setStatus(EAction.THINK);
+                               self.action.setStatus(EAction.THINK_IN_HOME);
                        };
                }
        });
@@ -1348,33 +1536,31 @@ window.onload = function(){
        });
 
 
-       var MoveCommandEvent = enchant.Class.create(Event,{
+       var MoveToCommandEvent = enchant.Class.create(Event,{
                initialize: function (_data){
                        this.data = _data;
                        this.yukkuri = this.data.myYukkuri;
                        this.action = this.data.action;
-                       this.vx = this.data.vx;
-                       this.vy = this.data.vy;
+                       // this.vx = this.data.cmdObject.vx;
+                       // this.vy = this.data.cmdObject.vy;
+                       // var vx = (-backgroundMap.x + e.x) - this.ctl.player.getX() ;
+
 
                        var yukkuri = this.yukkuri;
-                       this.action.status = EAction.MOVE_TO_EAT_UNDERWAY;
-                       yukkuri.vx = node.x - yukkuri.getX();
-                       yukkuri.vy = node.y - yukkuri.getY();
+                       this.action.status = EAction.WAIT;
+                       yukkuri.vx = this.data.cmdObject.touchX - this.yukkuri.getX();
+                       yukkuri.vy = this.data.cmdObject.touchY - this.yukkuri.getY();
                        var distance = (Math.abs(yukkuri.vx) + Math.abs(yukkuri.vy)) / 2;
-                       var frame = distance + 1;
+                       var frame = distance + distance/2 + 1;
                        frame += plusFrameScale(frame, this.yukkuri.getMyScale());
 
+                       yukkuri.setAutoDirection();
+
                        yukkuri.moveBy(yukkuri.vx, yukkuri.vy, frame, {
-                               "onactionstart": this.onactionstart(this),
                                "onactiontick": this.onactiontick(this),
                                "onactionend": this.onactionend(this)
                        });
                },
-               onactionstart:function(self){
-                       return function(e){
-                               if(typeof e === "undefined")return;
-                       };
-               },
                onactiontick:function(self){
                        return function(e){
                                if(typeof e === "undefined")return;
@@ -1397,10 +1583,15 @@ window.onload = function(){
                        this.targetYukkuri = _data.targetNode;
                        this.action = _data.action;
                        this.action.setStatus(EAction.COMMUNICATE_WAIT);
+                       // this.targetYukkuri.action.setStatus(EAction.COMMUNICATE_RECV);
+                       // this.targetYukkuri.tlPause();
                        mangMsg.output(this.yukkuri, EMsg.SAY_HELLO, this.targetYukkuri);
+                       this.yukkuri.send(this.targetYukkuri, {
+                               "actionStatus":EAction.COMMUNICATE_RECV,
+                               "yukkuri":this.yukkuri
+                       });
+
 
-                       this.targetYukkuri.action.setStatus(EAction.COMMUNICATE_RECV);
-                       this.targetYukkuri.tlPause();
                        this.yukkuri.tlPause();
                        this.yukkuri.syncDirection(this.targetYukkuri);
 
@@ -1479,9 +1670,8 @@ 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)
                        });
@@ -1556,6 +1746,41 @@ window.onload = function(){
                        return this.give;
                }
        });
+       var MemoryPlace = enchant.Class.create({
+               // initialize: function (place){
+               //      if(place.x != null){
+               //              this.isWorld = true;
+               //      }else{
+               //              this.isWorld = false;
+               //      }
+               //      this.isWorld = (place.x != null);
+               //      this.x = place.x;
+               //      this.y = place.y;
+               //      this.width = place.width;
+               //      this.height = place.height;
+               // },
+               // isWorld: function(){
+               //      return this.isWorld;
+               // }
+
+       });
+       var MemoryFood = enchant.Class.create({
+               initialize: function (food){
+                       if(food.x != null){
+                               this.isWorld = true;
+                       }else{
+                               this.isWorld = false;
+                       }
+                       this.isWorld = (food.x != null);
+                       this.x = food.x;
+                       this.y = food.y;
+                       this.width = food.width;
+                       this.height = food.height;
+               },
+               isWorld: function(){
+                       return this.isWorld;
+               }
+       });
        var Place = enchant.Class.create(ObjSprite,{
                initialize: function (type, x, y){
                        ObjSprite.call(this,128,128);
@@ -1647,7 +1872,8 @@ window.onload = function(){
                        this.x = x;
                        this.y = y;
                        backgroundMap.addChild(this);
-                       this.lifetime = 30 * 24 * 3;
+                       // this.lifetime = 30 * 24 * 3;
+                       this.lifetime = 15 * 24;
                        this.addEventListener('enterframe', this.runEnterframe(this));
                        // game.rootScene.addEventListener('enterframe', this.runEnterframe(this));
 
@@ -1667,9 +1893,6 @@ window.onload = function(){
 
                        };
                }
-               // runEnterframe: function(){
-               //      console.log("enterframe:" + this.id);
-               // }
        });
        var Okazari = enchant.Class.create(enchant.Sprite,{
                initialize: function(yukkuri){
@@ -1677,13 +1900,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;
-                               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.OKAZARI];
+                               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;
                },
@@ -1696,6 +1919,39 @@ window.onload = function(){
                        // return this.height * this.yukkuri.myScaleY;
                }
        });
+       var Kuki = enchant.Class.create(ObjSprite,{
+               initialize: function(yukkuri, x, y){
+                       this.classname = "Kuki";
+                       enchant.Sprite.call(this, 56, 40);
+                       this.image = game.assets[EResPath.KUKI];
+                       this.x = 0 + x;
+                       this.y = -CHARA_HEIGHT / 2 -CHARA_HEIGHT / 4 + y;
+                       this.owner = yukkuri;
+                       this.miYukkuris = [];
+               },
+               addMiYukkuri: function(miYukkuri){
+                       // miYukkuri.setX(miYukkuri.getX() + 30);
+                       // miYukkuri.setY(miYukkuri.getY() - 30);
+                       this.miYukkuris.push(miYukkuri);
+               },
+               getMiYukkuris: function(){
+                       return this.miYukkuris;
+               },
+               getX : function(){
+                       return this.x;
+               },
+               getY : function(){
+                       return this.y;
+               },
+               getWidth: function(){
+                       return this.width;
+                       // return this.width * this.yukkuri.myScaleX;
+               },
+               getHeight: function(){
+                       return this.height;
+                       // return this.height * this.yukkuri.myScaleY;
+               }
+       });
        var Address = enchant.Class.create({
                initialize: function(yukkuri){
                        this.friendlyLv = 1;
@@ -1721,6 +1977,8 @@ window.onload = function(){
                        ObjSprite.call(this, 64, 64);
                        this.searchObjectMang = new SearchObjectMang();
                        this.grow = grow;
+                       //base plyaer only
+                       this.cmdQueue = [];
                        this.myCode = "YUKKURI";
                        this.myName = "ゆっくり";
                        this.beforeHuntingFood = null;
@@ -1744,20 +2002,25 @@ window.onload = function(){
                                this.myScaleY = 0.3;
                                this.mySize = "SS";
                        }
+                       else if(grow == EGrow.FRUIT_BABY){
+                               this.myScaleX = 0.2;
+                               this.myScaleY = 0.2;
+                               this.mySize = "SSS";
+                       }
 
                        // ctl.game.rootScene.addEventListener('touchstart', this.touchstart);
                        this.classname = "Yukkuri";
                        this.addressBook = {};
-                       this.imgGroup = new SpriteGroup();
-                       this.imgBody = new SpriteGroup();
-                       this.imgGroup.id = guid();
-                       this.imgBody.id = guid();
+                       // this.imgGroup = new SpriteGroup();
+                       // this.imgBody = new SpriteGroup();
+                       // this.imgGroup.id = guid();
+                       // this.imgBody.id = guid();
                        this.x = -CHARA_WIDTH / 2;
                        this.y = -CHARA_HEIGHT / 2;
                        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;
@@ -1765,84 +2028,165 @@ window.onload = function(){
                        this.walkAnimationStatus = EWalkAnimation.END;
                        this.place = null;
                        this.items = [];
+                       this.actionQueue = [];
+                       this.exLvHash = {};
+                       this.exValueHash = {};
+                       this.memoryHash = {};
+                       this.communicateYukkuri = {};
+                       for(var _v in EExSkill){
+                               var key = EExSkill[_v];
+                               this.exLvHash[key] = 0;
+                               this.exValueHash[key] = 0;
+                       }
+                       this.kukis = [];
+                       this.formSprite = new FormSprite();
                },
                runEnterframe:function(){
+                       // console.log("runEnterframe");
+                               // this.formSprite.run();
+                               // this.formSprite.addX(1);
+
                        // try{
-                               this.act();
-                               if(this.isDead())return;
-                               this.runYukkuri();
-                               this.runHungry();
-                               this.runUnun();
-                               this.runSleep();
-                               this.runAddress();
+                               if(this.grow == EGrow.FRUIT_BABY){
+                               }else{
+                                       if(this.kukis){
+                                               // this.kukis[0].miYukkuris[0].setX(this.getX());
+                                               // this.kukis[0].miYukkuris[0].setY(this.getY());
+                                               // var _x = this.imgBody.tl.node.x;
+                                               // var _y = this.imgBody.tl.node.y;
+                                               // 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();
+                                       if(this.isDead())return;
+                                       this.runYukkuri();
+                                       this.runHungry();
+                                       this.runUnun();
+                                       this.runSleep();
+                                       this.runAddress();
+                                       this.runAnimation();
+                                       // this.animation();
+
+                               }
                        // }catch(e){
                        //      console.log(e);
                        // }
                },
                reverse:function(){
                        if(this.direction == EDirection.RIGHT){
-                               this.imgBody.scaleX = 1;
+                               this.formSprite.formScaleX(this.myScaleX);
+                               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;
                        }
                        else if(this.direction == EDirection.LEFT){
-                               this.imgBody.scaleX = -1;
+                               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;
                        }
                },
                tweet:function(text){
                        text = text.replace(/%name%/g, this.myName);
-                       this._tweet.text(text, this.x - this._tweet.width/4, this.y - this._tweet.height);
+                       // this._tweet.text(text, this.x - this._tweet.width/4, this.y - this._tweet.height);
+                       this._tweet.text(text, this.getX() - this._tweet.width/4, this.getY() - this._tweet.height);
                },
                moveTo:function(x, y, time){
-                       this.imgGroup.tl.moveTo(x, y, time, enchant.Easing.SIN_EASEINOUT);
+                       this.formSprite.tlMoveTo(x, y, time, enchant.Easing.SIN_EASEINOUT);
+                       // this.imgGroup.tl.moveTo(x, y, time, enchant.Easing.SIN_EASEINOUT);
                },
                moveBy:function(x, y, time, eventFunctions){
-                       var self = this;
-                       var params = {
-                               x: function() {
-                                       return self.imgGroup.x + x;
-                               },
-                               y: function() {
-                                       return self.imgGroup.y + y;
-                               },
-                               time: time,
-                               easing: enchant.Easing.SIN_EASEINOUT
-                       };
-                       //-Event register [onactionstart,onactiontick,onactionend]
-                       if(eventFunctions !== undefined){
-                               for(var key in eventFunctions){
-                                       params[key] = eventFunctions[key];
-                               }
-                       }
-                       return this.imgGroup.tl.tween(params);
+                       this.formSprite.tlMoveBy(x, y, time, eventFunctions);
+                       // var self = this;
+                       // var params = {
+                       //      x: function() {
+                       //              return self.getX() + x;
+                       //              // return self.imgGroup.x + x;
+                       //      },
+                       //      y: function() {
+                       //              return self.getY() + y;
+                       //              // return self.imgGroup.y + y;
+                       //      },
+                       //      time: time,
+                       //      easing: enchant.Easing.SIN_EASEINOUT
+                       // };
+                       // //-Event register [onactionstart,onactiontick,onactionend]
+                       // if(eventFunctions !== undefined){
+                       //      for(var key in eventFunctions){
+                       //              params[key] = eventFunctions[key];
+                       //      }
+                       // }
+                       // console.log("moveBy");
+                       // console.log("self.x:" + self.getX());
+                       // return this.formSprite.tlTween(params);
+                       // // return this.imgGroup.tl.tween(params);
                },
                wait:function(frame, eventFunctions){
-                       this.moveBy(0,1,frame,eventFunctions);
+                       this.moveBy(0,0,frame,eventFunctions);
                },
                act: function(){
                        this.action.act();
                },
+               runAnimation: function(){
+                       this.formSprite.formRunAnimation();
+               },
                animation: function(){
-
-                       var frame = 10;
-                       frame += plusFrameScale(frame, this.getMyScale());
-                       var move = 5;
-                       move -= plusFrameScale(move, this.getMyScale());
-                       if(this.walkAnimationStatus == EWalkAnimation.END){
-                               this.imgBody.y = 0;
-                               this.imgBody.tl.moveByEx(0, -move, frame, enchant.Easing.SWING, {
-                                       "onactionstart": function(e){
-                                               this.walkAnimationStatus = EWalkAnimation.START;
-                                       }
-                               })
-                               .moveByEx(0, move, frame, enchant.Easing.SWING,
-                               {
-                                       "onactionend": function(e){
-                                               this.walkAnimationStatus = EWalkAnimation.END;
-                                       }
-                               }).loop();
-
-                       }else{
-                               this.imgBody.tl.loop();
-                       }
+                       this.formSprite.formStartAnimation();
+                       // var frame = 10;
+                       // frame -= plusFrameScale(frame, this.getMyScale()) / 2;
+                       // var move = 5;
+                       // move -= plusFrameScale(move, this.getMyScale());
+                       // if(this.walkAnimationStatus == EWalkAnimation.END){
+                       //      this.imgBody.y = 0;
+                       //      this.imgBody.tl.moveByEx(0, -move, frame, enchant.Easing.SWING, {
+                       //              "onactionstart": function(e){
+                       //                      this.walkAnimationStatus = EWalkAnimation.START;
+                       //              }
+                       //      })
+                       //      .moveByEx(0, move, frame, enchant.Easing.SWING,
+                       //      {
+                       //              "onactionend": function(e){
+                       //                      this.walkAnimationStatus = EWalkAnimation.END;
+                       //              }
+                       //      }).loop();
+                       // }else{
+                       //      this.imgBody.tl.loop();
+                       // }
                },
                getMyScale: function(){
                        return (this.myScaleX + this.myScaleY) / 2;
@@ -1853,23 +2197,29 @@ window.onload = function(){
                getHeight: function(){
                        return this.height * this.myScaleY;
                },
+               setX: function(x){
+                       this.formSprite.setX(x);
+                       // this.imgGroup.x = x;
+               },
+               setY: function(y){
+                       this.formSprite.setY(y);
+                       // this.imgGroup.y = y;
+               },
                getX: function(){
-                       return this.imgGroup.x;
+                       return this.formSprite.getX();
+                       // return this.imgGroup.x;
                },
                getY: function(){
-                       return this.imgGroup.y;
+                       return this.formSprite.getY();
+                       // return this.imgGroup.y;
                },
                moveX: function(x){
-                       this.imgGroup.x += x;
-                       // this.x += x;
-                       // this.shadow.x += x;
-                       // this._tweet.x += x;
+                       this.formSprite.addX(x);
+                       // this.imgGroup.x += x;
                },
                moveY: function(y){
-                       this.imgGroup.y += y;
-                       // this.y += y;
-                       // this.shadow.y += y;
-                       // this._tweet.y += y;
+                       this.formSprite.addY(y);
+                       // this.imgGroup.y += y;
                },
                // changeFace: function(erespath){
                //      this.face.image = game.assets[erespath];
@@ -1890,18 +2240,38 @@ 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++;
+                       if(this.age%50 === 0 && this.age !== 0)this.param.hungry += ADD_HUNGRY;
                        if(this.param.hungry >= 100)this.param.hungry = 100;
                },
                runUnun: function(){
-                       if(this.age%50 === 0 && this.age !== 0)this.param.unun++;
+                       if(this.age%50 === 0 && this.age !== 0)this.param.unun += 1;
                        if(this.param.unun >= 100)this.param.unun = 100;
                },
                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;
                                }
@@ -1962,6 +2332,10 @@ window.onload = function(){
                        this.param.yukkuri = yukkuri;
                        if(this.param.yukkuri < 0)this.param.yukkuri = 0;
                },
+               addYukkuri: function(yukkuri){
+                       this.param.yukkuri += yukkuri;
+                       if(this.param.yukkuri < 0)this.param.yukkuri = 0;
+               },
                getHungry: function(){
                        return this.param.hungry;
                },
@@ -1972,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;
@@ -2025,10 +2414,15 @@ window.onload = function(){
 
                unun:function(){
                        if(this.direction == EDirection.RIGHT){
-                               new Unun(this.getX(), this.getY() + this.getHeight()/5 );
+                               new Unun(this.getX() -  this.getWidth()/5, this.getY() + this.getHeight()/5 );
                        }else{
                                new Unun(this.getX() -  this.getWidth()/5, this.getY() + this.getHeight()/5 );
                        }
+                       // if(this.direction == EDirection.RIGHT){
+                       //      new Unun(this.getX() + this.getWidth()/2 - this.getWidth()/5, this.getY() + this.getHeight() / 2 +  this.getHeight() / 5 );
+                       // }else{
+                       //      new Unun(this.getX() + this.getWidth()/2 - this.getWidth()/5, this.getY() + this.getHeight() / 2 + this.getHeight() / 5 );
+                       // }
                        this.setUnun(0);
                },
                setBodyImage: function(ebody){
@@ -2036,14 +2430,12 @@ window.onload = function(){
                        this.image = game.assets[path];
                },
                tlPause:function(){
-                       // this.imgBody.tl.pause();
-                       // this.imgGroup.tl.pause();
-                       this.imgBody.tl.clear();
-                       this.imgGroup.tl.clear();
-                       this.imgBody.tl.unloop();
-                       this.imgGroup.tl.unloop();
-                       this.imgBody.y = 0;
-
+                       // this.imgBody.tl.clear();
+                       // this.imgGroup.tl.clear();
+                       // this.imgBody.tl.unloop();
+                       // this.imgGroup.tl.unloop();
+                       // this.imgBody.y = 0;
+                       this.formSprite.formStopAnimation();
                },
                tlResume: function(){
                        // this.imgBody.tl.resume();
@@ -2052,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){
@@ -2080,6 +2474,8 @@ 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;
                },
                isItemsMax:function(){
@@ -2099,25 +2495,237 @@ window.onload = function(){
                        this.face.image = game.assets[path];
                },
                myScale: function(_scaleX, _scaleY){
-                       this.face.scale(_scaleX,_scaleY);
-                       if(this.myCode === "REIMU"){
-                               this.okazari.x = -CHARA_WIDTH / 2;
-                               this.okazari.x = -CHARA_WIDTH / 2 - CHARA_WIDTH / 8;
-                               this.okazari.y = -CHARA_HEIGHT / 3 - CHARA_HEIGHT/7;
-                       }else{
-                               this.okazari.x = -CHARA_WIDTH /2;
-                               this.okazari.y = -CHARA_HEIGHT / 2 - CHARA_HEIGHT/6;
+                       this.formSprite.scale(_scaleX, _scaleY);
+                       // this.face.scale(_scaleX,_scaleY);
+                       // if(this.myCode === "REIMU"){
+                       //      // this.okazari.x = -this.okazari.width / 2;
+                       //      // this.okazari.y = -CHARA_HEIGHT  / 2 + (this.okazari.height * (1 - _scaleY)) / 2;
+                       // }else{
+                       //      // this.okazari.x = -CHARA_WIDTH /2;
+                       //      // this.okazari.y = -CHARA_HEIGHT / 2 - (CHARA_HEIGHT * _scaleY)/6;
+                       // }
+                       // if(this.sub1 != null){
+                       //      this.sub1.scale(_scaleX,_scaleY);
+                       // }
+
+                       // this.okazari.scale(_scaleX,_scaleY);
+                       // this.hear.scale(_scaleX,_scaleY);
+                       // this.scale(_scaleX,_scaleY);
+                       // if(this.shadow)this.shadow.scale(_scaleX, _scaleY);
+               },
+               send: function(targetYukkuri, object, callback){
+                       this.communicateYukkuri = targetYukkuri;
+                       targetYukkuri.recv(object, callback);
+               },
+               recv: function(object, callback){
+                       this.communicateYukkuri = object.yukkuri;
+                       this.tlPause();
+                       this.action.setStatus(object.actionStatus);
+
+                       // this.actionQueue.push({
+                       //      object : object,
+                       //      callback: callback
+                       // });
+               },
+               addExValue: function(eexskill, plus){
+                       this.exValueHash[eexskill] += plus;
+                       if(this.exValueHash[eexskill] >= 100){
+                               this.exLvHash[eexskill] = 1;
                        }
+               },
+               getExValue: function(eexskill){
+                       return this.exValueHash[eexskill];
+               },
+               getExSkill: function(eexskill){
+                       return this.exLvHash[eexskill];
+               },
 
-                       this.okazari.scale(_scaleX,_scaleY);
-                       this.hear.scale(_scaleX,_scaleY);
-                       this.scale(_scaleX,_scaleY);
-                       this.shadow.scale(_scaleX, _scaleY);
+               setMemory: function(ememory, value){
+                       this.memoryHash[ememory] = value;
+               },
+               getMemory: function(ememory){
+                       return this.memoryHash[ememory];
+               },
+               damage: function(edamage){
+                       if(edamage == EDamage.PICOHAN){
+                               mangMsg.output(this, EMsg.DAMAGE);
+                               this.setFaceImage(EFace.CRY1);
+                               this.addYukkuri(-1);
+                               //現在の行動パターンから躾対象かセレクトする
+                       }
+               },
+               // 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;
+                       //      }
+                       // }
+               // },
+               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;
+                                       }
+                               }
+                       }
                },
                destruct: function(){
 
                }
        });
+       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);
@@ -2126,8 +2734,10 @@ window.onload = function(){
                        this.myName = "まりさ";
 
                        // var xml = this.loadParamsXML("./data/marisa/params.xml");
-                       var json = net.load("./data/marisa/params.json");
-                       this.param = json.root.param;
+                       // var json = net.load("./data/marisa/params.json");
+                       // this.param = json.root.param;
+                       this.param = new MarisaParam();
+                       this.param.looks = ELooks.GOOD_YUKKURI;
                        if(this.grow == EGrow.BABY){
                                this.myName = "まりちゃ";
                                this.param.range /= 4;
@@ -2137,12 +2747,12 @@ window.onload = function(){
                        }
                        else if(this.grow == EGrow.SUBADULT){
                                this.param.range *= 0.8;
+                       }else{
                        }
                        this.shadow = new enchant.Sprite(64, 64);
                        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.shadow.y = this.getHeight() / 16 + this.y;
 
                        this._style.zIndex = 5;
 
@@ -2150,7 +2760,6 @@ window.onload = function(){
                        this.face.image = game.assets[EResPath.MARISA_FACE_NORMAL];
                        this.face.x = -CHARA_WIDTH / 2;
                        this.face.y = -CHARA_HEIGHT / 2;
-                       this.face._style.zIndex = 0;
 
                        this.faceStatus ={};
                        this.faceStatus[EFace.NORMAL] = EResPath.MARISA_FACE_NORMAL;
@@ -2169,57 +2778,82 @@ window.onload = function(){
                        this.hear.image = game.assets[EResPath.MARISA_HEAR];
                        this.hear.x = -CHARA_WIDTH / 2;
                        this.hear.y = -CHARA_HEIGHT / 2;
-                       this.hear._style.zIndex = 0;
 
                        this.okazari = new Okazari(this);
 
-                       // this.imgGroup._style.zIndex = 1;
-
+                       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._tweet = new TTweet(this, 148, 64);
+
+                       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.imgGroup.addChild(this.shadow);
-                       this.imgBody.addChild(this);
-                       this.imgBody.addChild(this.face);
-                       this.imgBody.addChild(this.hear);
-                       this.imgBody.addChild(this.okazari);
+                       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.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);
+                       // this.imgBody.addChild(this.face);
+                       // this.imgBody.addChild(this.hear);
+                       // this.imgBody.addChild(this.okazari);
+                       // for(var i=0;i<this.kukis.length;i++){
+                       //      this.imgBody.addChild(this.kukis[i]);
+                       //      this.kukis[i].opacity = 0;
+                       // }
+                       // this.kuki = ;
+                       // this.imgBody.addChild(new Kuki(this));
                        this.myScale(this.myScaleX, this.myScaleY)
                        if(this instanceof Player){
-                               // this.myScaleX = 0.5;
-                               // this.myScaleY = 0.5;
-
                                this.budge = new enchant.Sprite(16, 16);
                                this.budge.image = game.assets[EResPath.PLAYER_BADGE];
-                               this.imgBody.addChild(this.budge);
-                               this.budge.x -= this.getWidth()/2;
-                               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(148, 64);
-
-                       this.imgGroup.addChild(this._tweet);
-                       this.imgGroup.x = x;
-                       this.imgGroup.y = y;
-
+                               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.imgGroup.width = this.getWidth();
+                       // this.imgGroup.height = this.getHeight();
+                       // this.imgGroup.addChild(this.imgBody);
+
+                       // backgroundMap.addChild(this.imgGroup);
+                       // this._tweet = new TTweet(148, 64);
+
+                       // 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);
                }
        });
        var Player = enchant.Class.create(Marisa,{
-               initialize: function(x, y){
+               initialize: function(x, y, grow){
                        // this.runEnterframe = function(){
                        // },
-                       Marisa.call(this, x, y, EGrow.ADULT);
+                       if(grow === undefined)grow = EGrow.ADULT;
+                       Marisa.call(this, x, y, grow);
                        this.classname = "Player";
-                       this.cmdQue = [];
                        ctl.setPlayer(this);
                        // this.removeEventListener('enterframe',this.runEnterframe);
                        this.addEventListener('enterframe', function(){
 
-
                                if(this.age%10 === 0 && this.age !== 0){
                                        // console.log("palyer:" + this.age);
                                }
@@ -2228,11 +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){
-                                       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){
@@ -2265,10 +2903,10 @@ 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;
+                       // var json = net.load("./data/reimu/params.json");
+                       // this.param = json.root.param;
+                       this.param = new ReimuParam();
                        if(this.grow == EGrow.BABY){
                                this.myName = "れいみゅ";
                                this.param.range /= 4;
@@ -2283,9 +2921,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];
@@ -2316,22 +2952,23 @@ window.onload = function(){
                        this.sub1.x = -CHARA_WIDTH / 2;
                        this.sub1.y = -CHARA_HEIGHT / 2;
 
-                       this.okazari = new Okazari(this);
-
-                       // this.imgGroup._style.zIndex = 1;
 
+                       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._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.myScaleX = 0.5;
-                               // this.myScaleY = 0.5;
-
                                this.budge = new enchant.Sprite(16, 16);
                                this.budge.image = game.assets[EResPath.PLAYER_BADGE];
                                this.imgBody.addChild(this.budge);
@@ -2339,24 +2976,20 @@ 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(148, 64);
-
-                       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);
+                       this.exLvHash[EExSkill.KEKKAI] = 1;
+                       this.exValueHash[EExSkill.KEKKAI] = 100;
                }
        });
 
        game.onload = function(){
                def.Food = Food;
+               def.Unun = Unun;
                def.Place = Place;
                def.ObjSprite = ObjSprite;
                def.Yukkuri = Yukkuri;
@@ -2383,7 +3016,6 @@ window.onload = function(){
                windowSurface.context.fillStyle = '#000';
                windowSurface.context.fillRect(0 + 20, EFieldPos.HEIGHT - 60, EFieldPos.WIDTH - 40, EFieldPos.HEIGHT);
 
-
                menuSurface.context.fillStyle = '#000';
                menuSurface.context.fillRect(0, 0, EMenuPos.WIDTH, EMenuPos.HEIGHT);
                menuBg.image = menuSurface;
@@ -2393,7 +3025,9 @@ window.onload = function(){
                mangIcon = new MangIcon(ctl, menuBg);
 
                game.rootScene.addChild(backgroundMap);
-               game.rootScene.addChild(windowFront);
+               // game.rootScene.addChild(windowFront);
+               // game.rootScene.addChild(gwindow);
+               // var gwindow = new GWindow(ctl, {}, 0, 0, 80, 80);
                game.rootScene.addChild(menuBg);
 
                // var labelGroup = new LabelGroup();
@@ -2410,14 +3044,88 @@ window.onload = function(){
                // var food = new def.Food("apple", 200, 250);
                backgroundMap.addChild(foodGroup);
                // backgroundMap.addChild(placeGroup);
-               var player = new Player(PALYER_INIT_X, PALYER_INIT_Y);
+               // 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 + 100, PALYER_INIT_Y + 200, EGrow.SUBADULT);
-               new Marisa(PALYER_INIT_X + 150, PALYER_INIT_Y + 200, EGrow.CHILD);
-               new Reimu(PALYER_INIT_X + 400, PALYER_INIT_Y + 400, 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 + 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);
                // new Unun(100, 100);
                // new Place("tree", PALYER_INIT_X, PALYER_INIT_Y - 50);
                var touchX = 0;
+               // var input = new Label("<form name='hoge' style='background-color:#ff0000;'>" +
+               //              "<input type='text' name='text'>" +
+               //              // "<select name='input_item' id='input_item'><option name='none'>りんご</option></select>" +
+               //              "</from>");
+               // input.y = 0;
+               // input.element.innerHTML = "<form name='hoge' style='background-color:#ff0000;'>" +
+               //              "<input type='text' name='text'>" +
+               //              // "<select name='input_item' id='input_item'><option name='none'>りんご</option></select>" +
+               //              "</from>";
+               // menuBg.addChild(input);
+               // game.rootScene.addChild(input);
+               // var inputEvent = new Label('');
+               // output.y = 64;
+               // game.rootScene.addChild(output);
+               // output.onenterframe = function(e) {
+               //              output.text = document.hoge.text.value;
+               //      };
+               // };
+               // enchant.Node.GAddEvent = function(){
+               // }
+               var popupStatus = null;
+               var testFlg = false;
+               var iconText = [];
+               game._element.addEventListener('mousemove', function (e) {
+                       var mang = mangTouch.get(ctl.getCurrentCommand());
+                       if(EMenuPos.X < e.layerX){
+                               var ex = e.layerX - EMenuPos.X;
+                               var ey = e.layerY;
+                               var hitFlg = false;
+                               for(var i=0;i<mangIcon.cmdIcons.length;i++){
+                                       var icon = mangIcon.cmdIcons[i];
+                                       if(icon.x <= ex && ex <= (icon.x + ICON_WIDTH)
+                                               && icon.y <= ey && ey <= (icon.y + ICON_HEIGHT)
+                                               ){
+                                               hitFlg = true;
+                                               if(popupStatus !== i){
+                                                       ctl.popup.renew(game.rootScene, EMenuPos.X + 5, e.layerY + ICON_HEIGHT / 2, 80, 80);
+                                                       ctl.popup.setText(icon.text);
+                                                       popupStatus = i;
+                                                       break;
+                                               }
+                                       }
+                               }
+
+                               if(hitFlg){
+                                       ctl.popup.opacity = 0.9;
+                                       ctl.popup.drawText();
+                               }
+                               else {
+                                       ctl.popup.opacity = 0;
+                               }
+                               // console.log(e.layerX + ":" + e.layerY);
+                       }
+               });
+               // enchant.Core.instance._element.addEventListener('mousemove', function(e) {
+
+               // game.rootScene.addEventListener('mousemove', function (e) {
+               //      console.log("mmmmmmmmm");
+               // });
 
 
                game.rootScene.addEventListener('touchstart', function (e) {
@@ -2436,13 +3144,13 @@ window.onload = function(){
                });
 
 
-               game.rootScene.addEventListener('enterframe', function(){
+               game.rootScene.addEventListener('enterframe', function(e){
                        //main frame
                        mangLabel.draw(player);
                        if(this.age%BASE_FPS == 0 ){
                                ctl.calcTime();
                        }
-                       ctl.time++;
+                       ctl.time += TIME_SPEED;
                });
                this.addEventListener('enterframe', function(){
                        //The priority processing of display instead of z-index
@@ -2453,3 +3161,5 @@ window.onload = function(){
        };
        game.start();
 };
+
+