OSDN Git Service

update
authornagoling <>
Wed, 16 Oct 2013 02:29:53 +0000 (11:29 +0900)
committernagomi <nagomi@192.168.1.23>
Wed, 16 Oct 2013 02:29:53 +0000 (11:29 +0900)
ctrl.js
data/marisa/params.json
lang/ja.js
main.js

diff --git a/ctrl.js b/ctrl.js
index 5d5afed..9117154 100644 (file)
--- a/ctrl.js
+++ b/ctrl.js
@@ -9,6 +9,17 @@ var Ctrl = enchant.Class.create({
                this.def = null;
                this.objSprite = null;
                this.mangTouch = null;
+               this.time = 0;
+               this.min = 0;
+               this.hour = 0;
+               this.day = 1;
+       },
+       calcTime:function(){
+               var sec = ctl.time/BASE_FPS;
+               this.min = Math.ceil(sec % 60);
+               var _min = sec / 60;
+               this.hour = Math.ceil(_min % 24);
+               this.day = Math.ceil(_min / 24 % 30);
        },
        init : function (game){
                this.game = game;
@@ -35,6 +46,9 @@ var Ctrl = enchant.Class.create({
        setPlayer: function(player){
                this.player = player;
        },
+       setTime: function(time){
+               this.time = time;
+       },
        setCurrentObjSprite: function(objSprite){
                this.objSprite = objSprite;
        },
@@ -274,7 +288,7 @@ var MangLabel = enchant.Class.create({
                        "yukkuri" : {
                                label: null,
                                init: function(){
-                                       var TEXT = M.LABEL_YUKKURI;
+                                       var TEXT = M.LABEL.YUKKURI;
                                        var label = new Label(TEXT);
                                        label.color = COLOR;
                                        label.font = FONT;
@@ -295,7 +309,7 @@ var MangLabel = enchant.Class.create({
                        "hungry" : {
                                label: null,
                                init: function(){
-                                       var TEXT = M.LABEL_HUNGRY;
+                                       var TEXT = M.LABEL.HUNGRY;
                                        var label = new Label(TEXT);
                                        label.color = COLOR;
                                        label.font = FONT;
@@ -315,7 +329,7 @@ var MangLabel = enchant.Class.create({
                        "unun" : {
                                label: null,
                                init: function(){
-                                       var TEXT = M.LABEL_UNUN;
+                                       var TEXT = M.LABEL.UNUN;
                                        var label = new Label(TEXT);
                                        label.color = COLOR;
                                        label.font = FONT;
@@ -335,7 +349,7 @@ var MangLabel = enchant.Class.create({
                        "sleep" : {
                                label: null,
                                init: function(){
-                                       var TEXT = M.LABEL_SLEEP;
+                                       var TEXT = M.LABEL.SLEEP;
                                        var label = new Label(TEXT);
                                        label.color = COLOR;
                                        label.font = FONT;
@@ -355,7 +369,7 @@ var MangLabel = enchant.Class.create({
                        "stress" : {
                                label: null,
                                init: function(){
-                                       var TEXT = M.LABEL_STRESS;
+                                       var TEXT = M.LABEL.STRESS;
                                        var label = new Label(TEXT);
                                        label.color = COLOR;
                                        label.font = FONT;
@@ -395,68 +409,90 @@ var MangMsg = enchant.Class.create({
        },
        output:function(yukkuri, emsg, targetYukkuri){
                //var M = yukkuri.getMsg();
+               var myCode = yukkuri.myCode;
+               var mySize = yukkuri.mySize;
+               if(myCode === null || myCode === undefined){
+                       myCode = "BASE";
+                       mySize = "L";
+               }
+
                if(emsg == EMsg.WALK){
                        if(rand(4) === 0){
-                               yukkuri.tweet(M.WALK1);
+                               yukkuri.tweet(M.get(myCode,mySize,"WALK1"));
                        }
                        else if(rand(4) === 1){
-                               yukkuri.tweet(M.WALK2);
+                               yukkuri.tweet(M.get(myCode,mySize,"WALK2"));
                        }
                        else if(rand(4) === 2){
-                               yukkuri.tweet(M.WALK3);
+                               yukkuri.tweet(M.get(myCode,mySize,"WALK3"));
                        }
                        else if(rand(4) === 3){
-                               yukkuri.tweet(M.WALK4);
+                               yukkuri.tweet(M.get(myCode,mySize,"WALK4"));
                        }
                }
                else if(emsg == EMsg.EAT){
                        if(rand(3) === 0){
-                               yukkuri.tweet(M.EAT1);
+                               yukkuri.tweet(M.get(myCode,mySize,"EAT1"));
                        }
                        else if(rand(3) === 1){
-                               yukkuri.tweet(M.EAT2);
+                               yukkuri.tweet(M.get(myCode,mySize,"EAT2"));
                        }
                        else if(rand(3) === 2){
-                               yukkuri.tweet(M.EAT3);
+                               yukkuri.tweet(M.get(myCode,mySize,"EAT3"));
                        }
                }
                else if(emsg == EMsg.GET_UP){
-                       yukkuri.tweet(M.GET_UP1);
+                       yukkuri.tweet(M.get(myCode,mySize,"GET_UP1"));
                }
                else if(emsg == EMsg.SLEEP){
-                       yukkuri.tweet(M.SLEEP1);
+                       yukkuri.tweet(M.get(myCode,mySize,"SLEEP1"));
                }
                else if(emsg == EMsg.DEAD){
-                       yukkuri.tweet(M.DEAD1);
+                       yukkuri.tweet(M.get(myCode,mySize,"DEAD1"));
                }
                else if(emsg == EMsg.UNUN){
                        if(rand(2) === 0){
-                               yukkuri.tweet(M.UNUN1);
+                               yukkuri.tweet(M.get(myCode,mySize,"UNUN1"));
                        }else{
-                               yukkuri.tweet(M.UNUN2);
+                               yukkuri.tweet(M.get(myCode,mySize,"UNUN2"));
                        }
                }
                else if(emsg == EMsg.UNUN_END){
-                       yukkuri.tweet(M.UNUN_END1);
+                       yukkuri.tweet(M.get(myCode,mySize,"UNUN_END1"));
                }
                else if(emsg == EMsg.UNUN_SMELL){
-                       yukkuri.tweet(M.UNUN_SPELL1);
+                       yukkuri.tweet(M.get(myCode,mySize,"UNUN_SPELL1"));
                }
                else if(emsg == EMsg.EAT_FAILED){
-                       yukkuri.tweet(M.EAT_FAILED1);
+                       yukkuri.tweet(M.get(myCode,mySize,"EAT_FAILED1"));
                }
                else if(emsg == EMsg.SAY_HELLO){
                        if(yukkuri.getAddress(targetYukkuri) === null){
-                               yukkuri.tweet(M.SAY_HELLO1);
+                               yukkuri.tweet(M.get(myCode,mySize,"SAY_HELLO1"));
                        }else{
-                               yukkuri.tweet(M.SAY_HELLO2);
+                               yukkuri.tweet(M.get(myCode,mySize,"SAY_HELLO2"));
                        }
                }
                else if(emsg == EMsg.TARGETING_EAT){
-                       yukkuri.tweet(M.TARGETING_EAT1);
+                       yukkuri.tweet(M.get(myCode,mySize,"TARGETING_EAT1"));
                }
                else if(emsg == EMsg.DECLARE_PLACE){
-                       yukkuri.tweet(M.DECLARE_PLACE1);
+                       yukkuri.tweet(M.get(myCode,mySize,"DECLARE_PLACE1"));
+               }
+               else if(emsg == EMsg.HUNT){
+                       yukkuri.tweet(M.get(myCode,mySize,"HUNT1"));
+               }
+               else if(emsg == EMsg.REHUNT){
+                       yukkuri.tweet(M.get(myCode,mySize,"REHUNT1"));
+               }
+               else if(emsg == EMsg.HUNT_ESCAPE){
+                       yukkuri.tweet(M.get(myCode,mySize,"HUNT_ESCAPE1"));
+               }
+               else if(emsg == EMsg.GOTO_HOME){
+                       yukkuri.tweet(M.get(myCode,mySize,"GOTO_HOME1"));
+               }
+               else if(emsg == EMsg.YYUYYU){
+                       yukkuri.tweet(M.get(myCode,mySize,"YYUYYU1"));
                }
 
        }
index 24c8a6b..aa21525 100644 (file)
@@ -9,6 +9,7 @@
                        "stress":0,
                        "int":0,
                        "str":0,
+                       "items_max":10,
                        "range":200
                },
                "img":{
index b97dad4..fe1537a 100644 (file)
 var M = {};
-M.WALK1 = "ゆっ!ゆっ!\nゆっくりすすむよっ!";
-M.WALK2 = "ゆっくり、ゆっくりー!";
-M.WALK3 = "かもしかのようなあんよで\nゆっくりすすむのぜ!";
-M.WALK4 = "ゆっくり\nぴょんぴょんするよ!";
-M.GET_UP1 = "ゆっくりおきるよ!";
-M.SLEEP1 = "すーやすーや。";
-M.SLEEP2 = "ゆぅ・・・ゆぅ・・・";
-M.DEAD1 = "もっとゆっくりしたかった…";
-M.EAT1 = "む~しゃむ~しゃ!\nそれなり~";
-M.EAT2 = "はふっはふっ!\nめっちゃうま!";
-M.EAT3 = "む~しゃむ~しゃ\nしあわせー";
-M.UNUN1 = "すーぱうんうんたーいむ!\nはじまるよ!";
-M.UNUN2 = "うんうんするよーー!!";
-M.UNUN3 = "うんうんあげるから\nよろこんでたべてねっ!!";
-M.UNUN_END1 = "すっきりー!";
-M.SEARCH_FOOD1 = "ゆゆ??\nたべものさん\nはっけんなのぜ!";
-M.UNUN_SPELL1 = "うんうんくさい!";
-M.EAT_FAILED1 = "どぼじで\nたべものさん\nないのおおおおお!?";
-M.SAY_HELLO1 = "まりさはまりさだよ!\nゆっくりしていってね!";
-M.SAY_HELLO2 = "ゆっくりしていってね!";
-M.TARGETING_EAT1 = "ゆゆ??\nたべものさん\nはっけんなのぜ!";
-M.DECLARE_PLACE1 = "ここをまりさの\nゆっくりぷれいすにするよ!";
-
-
-M.LABEL_YUKKURI = "ゆっくり";
-M.LABEL_HUNGRY = "空腹";
-M.LABEL_UNUN = "うんうん";
-M.LABEL_SLEEP = "眠気";
-M.LABEL_STRESS = "ストレス";
\ No newline at end of file
+
+M.get = function(code, size, key){
+       if(M[code] == null)code = "BASE";
+       if(M[code][size] == null)size = "L";
+       if(M[code][size][key] == null){
+               code = "BASE";
+               if(M[code][size][key] == null)return "";
+       }
+       return M[code][size][key];
+};
+
+M.BASE = {};
+M.BASE.L = {};
+M.BASE.L.WALK1 = "ゆっ!ゆっ!\nゆっくりすすむよっ!";
+M.BASE.L.WALK2 = "ゆっくり、ゆっくりー!";
+M.BASE.L.WALK3 = "かもしかのようなあんよで\nゆっくりすすむよ!";
+M.BASE.L.WALK4 = "ゆっくり\nぴょんぴょんするよ!";
+M.BASE.L.GET_UP1 = "ゆっくりおきるよ!";
+M.BASE.L.SLEEP1 = "すーやすーや。";
+M.BASE.L.SLEEP2 = "ゆぅ・・・ゆぅ・・・";
+M.BASE.L.DEAD1 = "もっとゆっくりしたかった…";
+M.BASE.L.EAT1 = "む~しゃむ~しゃ!\nそれなり~";
+M.BASE.L.EAT2 = "はふっはふっ!\nめっちゃうま!";
+M.BASE.L.EAT3 = "む~しゃむ~しゃ\nしあわせー";
+M.BASE.L.UNUN1 = "すーぱうんうんたーいむ!\nはじまるよ!";
+M.BASE.L.UNUN2 = "うんうんするよーー!!";
+M.BASE.L.UNUN3 = "うんうんあげるから\nよろこんでたべてねっ!!";
+M.BASE.L.UNUN_END1 = "すっきりー!";
+M.BASE.L.SEARCH_FOOD1 = "ゆゆ??\nたべものさんだよ!";
+M.BASE.L.UNUN_SPELL1 = "うんうんくさい!";
+M.BASE.L.EAT_FAILED1 = "どぼじで\nたべものさん\nないのおおおおお!?";
+M.BASE.L.SAY_HELLO1 = "%name%は%name%だよ!\nゆっくりしていってね!";
+M.BASE.L.SAY_HELLO2 = "ゆっくりしていってね!";
+M.BASE.L.TARGETING_EAT1 = "ゆゆ??\nたべものさんnはっけんだよ!";
+M.BASE.L.DECLARE_PLACE1 = "ここを%name%の\nゆっくりぷれいすにするよ!";
+M.BASE.L.HUNT1 = "ゆっくりかりをするよ!!";
+M.BASE.L.HUNT2 = "ゆー♪たいっりょうだよ~";
+M.BASE.L.REHUNT1 = "ゆっくりほかのたべものさんさがすよ!";
+M.BASE.L.HUNT_ESCAPE1 = "ゆ~たいりょうだよ~";
+M.BASE.L.YYUYYU1 = "ゆっゆっゆ";
+M.BASE.L.GOTO_HOME1 = "ゆっくりおうちにかえるよ!";
+
+
+
+M.MARISA = {};
+M.MARISA.L = {};
+M.MARISA.L.WALK1 = "ゆっ!ゆっ!\nゆっくりすすむよっ!";
+M.MARISA.L.WALK2 = "ゆっくり、ゆっくりー!";
+M.MARISA.L.WALK3 = "かもしかのようなあんよで\nゆっくりすすむのぜ!";
+M.MARISA.L.WALK4 = "ゆっくり\nぴょんぴょんするのぜ!";
+M.MARISA.L.GET_UP1 = "ゆっくりおきるよ!";
+M.MARISA.L.SLEEP1 = "すーやすーや。";
+M.MARISA.L.SLEEP2 = "ゆぅ・・・ゆぅ・・・";
+M.MARISA.L.DEAD1 = "もっとゆっくりしたかった…";
+M.MARISA.L.EAT1 = "む~しゃむ~しゃ!\nそれなり~";
+M.MARISA.L.EAT2 = "はふっはふっ!\nめっちゃうま!";
+M.MARISA.L.EAT3 = "む~しゃむ~しゃ\nしあわせー";
+M.MARISA.L.UNUN1 = "すーぱうんうんたーいむ!\nはじまるよ!";
+M.MARISA.L.UNUN2 = "うんうんするよーー!!";
+M.MARISA.L.UNUN3 = "うんうんあげるから\nよろこんでたべてねっ!!";
+M.MARISA.L.UNUN_END1 = "すっきりー!";
+M.MARISA.L.SEARCH_FOOD1 = "ゆゆ??\nたべものさん\nはっけんなのぜ!";
+M.MARISA.L.UNUN_SPELL1 = "うんうんくさい!";
+M.MARISA.L.EAT_FAILED1 = "どぼじで\nたべものさん\nないのおおおおお!?";
+M.MARISA.L.SAY_HELLO1 = "%name%は%name%だよ!\nゆっくりしていってね!";
+M.MARISA.L.SAY_HELLO2 = "ゆっくりしていってね!";
+M.MARISA.L.TARGETING_EAT1 = "ゆゆ??\nたべものさん\nはっけんなのぜ!";
+M.MARISA.L.DECLARE_PLACE1 = "ここを%name%の\nゆっくりぷれいすにするのぜ!";
+M.MARISA.L.HUNT1 = "ゆっくりかりをするのぜ!!";
+M.MARISA.L.HUNT2 = "ゆー♪たいっりょうなのぜ~";
+
+
+M.MARISA.SS = {};
+M.MARISA.SS.WALK1 = "ゆっ!ゆっ!\nゆっくちしゅしゅむのじぇっ!";
+M.MARISA.SS.WALK2 = "ゆっくち、ゆっくちー!";
+M.MARISA.SS.WALK3 = "かもしかようなあんよで\nゆっくちしゅしゅむのじぇ!";
+M.MARISA.SS.WALK4 = "ゆっくち\nぴょんぴょんするのじぇ!";
+M.MARISA.SS.GET_UP1 = "ゆっくちおきるよ!";
+M.MARISA.SS.SLEEP1 = "すーやすーや。";
+M.MARISA.SS.SLEEP2 = "ゆぅ・・・ゆぅ・・・";
+M.MARISA.SS.DEAD1 = "もっとゆっくちしたかった…";
+M.MARISA.SS.EAT1 = "む~ちゃむ~ちゃ!\nしょれなり~";
+M.MARISA.SS.EAT2 = "はふっはふっ!\nめっちゃうま!";
+M.MARISA.SS.EAT3 = "む~ちゃむ~ちゃ\nちあわせー";
+M.MARISA.SS.UNUN1 = "すーぱうんうんたーいむ!\nはじまるよ!";
+M.MARISA.SS.UNUN2 = "うんうんしゅるよーー!!";
+M.MARISA.SS.UNUN3 = "うんうんあげるから\nよろこんでたべちぇねっ!!";
+M.MARISA.SS.UNUN_END1 = "すっきりー!";
+M.MARISA.SS.SEARCH_FOOD1 = "ゆゆ??\nたべものしゃん\nはっけんなのじぇ!";
+M.MARISA.SS.UNUN_SPELL1 = "うんうんくちゃい!";
+M.MARISA.SS.EAT_FAILED1 = "どぼじで\nたべものしゃん\nないのおおおおお!?";
+M.MARISA.SS.SAY_HELLO1 = "%name%は%name%だよ!\nゆっくちしていってね!";
+M.MARISA.SS.SAY_HELLO2 = "ゆっくちしていってね!";
+M.MARISA.SS.TARGETING_EAT1 = "ゆゆ??\nたべものしゃん\nはっけんなのじぇ!";
+M.MARISA.SS.DECLARE_PLACE1 = "ここを%name%の\nゆっくちぷれいすにするのじぇ!";
+M.MARISA.SS.HUNT1 = "ゆっくちかりをするのじぇ!!";
+M.MARISA.SS.HUNT2 = "ゆー♪たいっりょうなのじぇ~";
+
+
+M.LABEL = {};
+M.LABEL.YUKKURI = "ゆっくり";
+M.LABEL.HUNGRY = "空腹";
+M.LABEL.UNUN = "うんうん";
+M.LABEL.SLEEP = "眠気";
+M.LABEL.STRESS = "ストレス";
\ No newline at end of file
diff --git a/main.js b/main.js
index c335aba..718003e 100644 (file)
--- a/main.js
+++ b/main.js
@@ -32,13 +32,14 @@ var CHARA_WIDTH = 64;
 var CHARA_HEIGHT = 64;
 var GAME_WIDTH = 800;
 var GAME_HEIGHT = 600;
-var FPS = 20;
+var FPS = 40;
 var BASE_FPS = 20;
 var HUNGRY_MAX = 100;
 var MIN = BASE_FPS;
 var HOUR = MIN * 60;
 // var DAY = HOUR * 24;
 var DAY = HOUR ;
+var GAME_START_TIME = HOUR * 6;
 
 var EResPath = {
        YUKKURI_BASE : './data/yukkuri_base.png',
@@ -126,6 +127,9 @@ var EAction = {
        DECLARE_PLACE_HOMELESS: 24,
        MOVE_TO_HUNT_START: 25,
        THINK_SCHEDULE: 26,
+       HUNT_START: 27,
+       GOTO_HOME: 28,
+       HOME_RETURN: 29,
        NONE: 9999
 };
 var EDirection = {
@@ -146,6 +150,11 @@ var EMsg = {
        SAY_HELLO: 10,
        TARGETING_EAT : 11,
        DECLARE_PLACE: 12,
+       HUNT: 13,
+       REHUNT: 14,
+       HUNT_ESCAPE: 15,
+       YYUYYU: 16,
+       GOTO_HOME:17,
 };
 var EWalkAnimation = {
        START: 0,
@@ -241,6 +250,14 @@ window.onload = function(){
                if(b instanceof Box){
                        return -1;
                }
+               if(a instanceof SpriteGroup){
+                       ay = a.y;
+                       ay += a.height/2;
+               }
+               if(b instanceof SpriteGroup){
+                       by = b.y;
+                       by += b.height /2;
+               }
 
                if(a instanceof Place){
                        ay += Math.round(a.height * 0.7);
@@ -385,6 +402,18 @@ window.onload = function(){
                                case EAction.DECLARE_PLACE_HOMELESS:
                                        this.declare_place_homeless();
                                break;
+                               case EAction.MOVE_TO_HUNT_START:
+                                       this.move_to_hunt_start();
+                               break;
+                               case EAction.HUNT_START:
+                                       this.hunt_start();
+                               break;
+                               case EAction.GOTO_HOME:
+                                       this.goto_home();
+                               break;
+                               case EAction.HOME_RETURN:
+                                       this.return_home();
+                               break;
 
                        }
                        this.yukkuri.reverse();
@@ -535,6 +564,40 @@ window.onload = function(){
                                "myYukkuri": this.yukkuri
                        });
                },
+               move_to_hunt_start:function(){
+                       new MoveToHuntEvent({
+                               "type": 'food',
+                               "targetNode": this.targetNode,
+                               "action": this,
+                               "myYukkuri": this.yukkuri
+                       });
+               },
+               hunt_start:function(){
+                       new HuntStartEvent({
+                               "type": 'food',
+                               "targetNode": this.targetNode,
+                               "action": this,
+                               "myYukkuri": this.yukkuri
+                       });
+               },
+               goto_home:function(){
+                       var place = this.yukkuri.getPlace();
+                       new GotoHomeEvent({
+                               "type": 'hunt_end',
+                               "targetNode": place,
+                               "action": this,
+                               "myYukkuri": this.yukkuri
+                       });
+               },
+               return_home:function(){
+                       var place = this.yukkuri.getPlace();
+                       new ReturnHomeEvent({
+                               "type": 'hunt_end',
+                               "targetNode": place,
+                               "action": this,
+                               "myYukkuri": this.yukkuri
+                       });
+               },
                move_to_command: function(){
 
                },
@@ -556,11 +619,11 @@ window.onload = function(){
                                        return;
                                }
                                else if (node instanceof Food) {
-                                       if(this.yukkuri.isKuhuku() && this.yukkuri.within(node, this.yukkuri.getRange())){
+                                       if(!this.yukkuri.isItemsMax() && this.yukkuri.within(node, this.yukkuri.getRange())){
 
                                                //A yukkuri to go to the food area
                                                this.targetNode = node;
-                                               this.setStatus(EAction.MOVE_TO_EAT_START);
+                                               this.setStatus(EAction.MOVE_TO_HUNT_START);
 
                                                return;
                                        }else{
@@ -854,6 +917,164 @@ window.onload = function(){
                        };
                }
        });
+       var MoveToHuntEvent = enchant.Class.create(Event,{
+               initialize: function (_data){
+                       this.data = _data;
+                       this.yukkuri = this.data.myYukkuri;
+                       this.action = this.data.action;
+
+                       var yukkuri = this.yukkuri;
+                       var node = this.data.targetNode;
+                       //food distance
+                       if(this.data.type == "food"){
+                               this.action.setStatus(EAction.WAIT);
+                               yukkuri.vx = node.x - yukkuri.getX() + node.width / 2;
+                               yukkuri.vy = node.y - yukkuri.getY() - yukkuri.getHeight() / 2 + node.height / 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.reverse();
+                               mangMsg.output(EMsg.TARGETING_EAT);
+
+                               yukkuri.moveBy(yukkuri.vx, yukkuri.vy, frame, {
+                                       "onactionend": this.onactionend(this)
+                               });
+                       }
+               },
+               onactionend:function(self){
+                       return function(e){
+                               if(typeof e === "undefined")return;
+                               self.action.setStatus(EAction.HUNT_START);
+                       };
+               }
+       });
+       var HuntStartEvent = enchant.Class.create(Event,{
+               initialize: function (_data){
+                       this.data = _data;
+                       this.yukkuri = _data.myYukkuri;
+                       this.food = _data.targetNode;
+                       this.action = _data.action;
+                       this.action.setStatus(EAction.WAIT);
+
+
+                       var sec = BASE_FPS * 8;
+                       if(this.yukkuri.hunt(this.food)){
+                               mangMsg.output(this.yukkuri, EMsg.HUNT);
+                               this.yukkuri.setFaceImage(EFace.HAPPY1);
+                       }else{
+                               if(this.yukkuri.isItemsMax()){
+                                       mangMsg.output(this.yukkuri, EMsg.REHUNT);
+                                       this.yukkuri.setFaceImage(EFace.NORMAL);
+                               }else{
+                                       mangMsg.output(this.yukkuri, EMsg.EAT_FAILED);
+                                       this.yukkuri.setFaceImage(EFace.CRY2);
+                               }
+                       }
+                       this.yukkuri.wait(sec, {
+                               "onactiontick": this.onactiontick(this),
+                               "onactionend": this.onactionend(this)
+                       });
+               },
+               onactiontick:function(self){
+                       return function(e){
+                               if(typeof e === "undefined")return;
+                               if(this.age%(BASE_FPS * 3) == 0){
+                                       mangMsg.output(self.yukkuri, EMsg.YYUYYU)
+                               }
+                       };
+               },
+               onactionend:function(self){
+                       return function(e){
+                               if(typeof e === "undefined")return;
+                               console.log("onactionend");
+                               self.action.setStatus(EAction.GOTO_HOME);
+                               mangMsg.output(self.yukkuri, EMsg.GOTO_HOME);
+                       };
+               }
+       });
+       var GotoHomeEvent = enchant.Class.create(Event,{
+               initialize: function (_data){
+                       this.data = _data;
+                       this.yukkuri = this.data.myYukkuri;
+                       this.action = this.data.action;
+
+                       var yukkuri = this.yukkuri;
+                       var place = this.data.targetNode;
+                       //food distance
+                       if(this.data.type == "hunt_end"){
+                               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;
+                               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.reverse();
+                               mangMsg.output(this.yukkuri, EMsg.GOTO_HOME)
+
+                               yukkuri.moveBy(yukkuri.vx, yukkuri.vy, frame, {
+                                       "onactiontick": this.onactiontick(this),
+                                       "onactionend": this.onactionend(this)
+                               });
+                       }
+               },
+               onactiontick:function(self){
+                       return function(e){
+                               if(typeof e === "undefined")return;
+                               if(this.age%(BASE_FPS * 5) == 0){
+                                       mangMsg.output(self.yukkuri, EMsg.YYUYYU)
+                               }
+                       };
+               },
+               onactionend:function(self){
+                       return function(e){
+                               if(typeof e === "undefined")return;
+                               self.action.setStatus(EAction.HOME_RETURN);
+                       };
+               }
+       });
+
+       var ReturnHomeEvent = enchant.Class.create(Event,{
+               initialize: function (_data){
+                       this.data = _data;
+                       this.yukkuri = this.data.myYukkuri;
+                       this.action = this.data.action;
+
+                       var yukkuri = this.yukkuri;
+                       var place = this.data.targetNode;
+                       if(this.data.type == "hunt_end"){
+                               this.action.setStatus(EAction.WAIT);
+                               var items = this.yukkuri.getItems();
+                               if(items.length > 0){
+                                       place.setItems(items);
+                               }else{
+
+                               }
+                               var sec = BASE_FPS * 10;
+                               this.yukkuri.wait(sec, {
+                                       "onactiontick": this.onactiontick(this),
+                                       "onactionend": this.onactionend(this)
+                               });
+                       }
+               },
+               onactiontick:function(self){
+                       return function(e){
+                               if(typeof e === "undefined")return;
+                               if(this.age%(BASE_FPS * 5) == 0){
+                                       mangMsg.output(self.yukkuri, EMsg.YYUYYU)
+                               }
+                       };
+               },
+               onactionend:function(self){
+                       return function(e){
+                               if(typeof e === "undefined")return;
+                               self.action.setStatus(EAction.THINK);
+                       };
+               }
+       });
+
+
        var MoveCommandEvent = enchant.Class.create(Event,{
                initialize: function (_data){
                        this.data = _data;
@@ -1104,6 +1325,16 @@ window.onload = function(){
                        ret += "食料にがにが  " + this.foodsBad + "\n";
                        return ret;
                },
+               setItems:function(items){
+                       var len = items.length;
+                       for(var i=0; i<len; i++){
+                               var item = items[i];
+                               if(item instanceof Food){
+                                       this.foodsNormal++;
+                               }
+                       }
+                       items.length = 0;
+               },
                setOwner: function(yukkuri){
                        this.owner = yukkuri;
                },
@@ -1185,21 +1416,27 @@ window.onload = function(){
                initialize: function(x, y, grow){
                        ObjSprite.call(this, 64, 64);
                        this.grow = grow;
+                       this.myCode = "YUKKURI";
+                       this.myName = "ゆっくり";
                        if(grow == EGrow.ADULT){
                                this.myScaleX = 1;
                                this.myScaleY = 1;
+                               this.mySize = "L";
                        }
                        else if(grow == EGrow.SUBADULT){
                                this.myScaleX = 0.8;
                                this.myScaleY = 0.8;
+                               this.mySize = "M";
                        }
                        else if(grow == EGrow.CHILD){
                                this.myScaleX = 0.6;
                                this.myScaleY = 0.6;
+                               this.mySize = "S";
                        }
                        else if(grow == EGrow.BABY){
-                               this.myScaleX = 0.4;
-                               this.myScaleY = 0.4;
+                               this.myScaleX = 0.3;
+                               this.myScaleY = 0.3;
+                               this.mySize = "SS";
                        }
 
                        // ctl.game.rootScene.addEventListener('touchstart', this.touchstart);
@@ -1221,6 +1458,7 @@ window.onload = function(){
                        this.bodyStatus[EBody.DEAD] = EResPath.YUKKURI_BODY_DEAD;
                        this.walkAnimationStatus = EWalkAnimation.END;
                        this.place = null;
+                       this.items = [];
                },
                runEnterframe:function(){
                        try{
@@ -1244,6 +1482,7 @@ window.onload = function(){
                        }
                },
                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);
                },
                moveTo:function(x, y, time){
@@ -1441,9 +1680,23 @@ window.onload = function(){
                                return false;
                        }
                },
+               hunt:function(food){
+                       if(food.amount > 0){
+                               if(!this.isItemsMax()){
+                                       food.amount--;
+                                       this.items.push(food);
+                                       this.setYukkuri(this.getYukkuri() + 1);
+                                       return true;
+                               }
+                       }
+                       return false;
+               },
                declarePlace: function(place){
                        this.place = place;
                },
+               getPlace:function(){
+                       return this.place;
+               },
                isPlace: function(){
                        return this.place !== null;
                },
@@ -1463,6 +1716,8 @@ window.onload = function(){
                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;
@@ -1499,9 +1754,17 @@ window.onload = function(){
                        var placeId = (this.place==null)?"無し" : this.place.id;
                        ret += "ID " + this.id + "\n";
                        ret += "プレイス  " + placeId + "\n";
+                       ret += "ゆっくり  " + this.getYukkuri() + "\n";
+                       ret += "空腹  " + this.getHungry() + "\n";
                        ret += "うんうん  " + this.getUnun() + "\n";
                        return ret;
                },
+               isItemsMax:function(){
+                       return this.items.length >= this.param.items_max;
+               },
+               getItems:function(){
+                       return this.items;
+               },
                destruct: function(){
 
                }
@@ -1510,10 +1773,22 @@ window.onload = function(){
                initialize: function(x, y, grow){
                        Yukkuri.call(this,x,y, grow);
                        this.classname = "Marisa";
+                       this.myCode = "MARISA";
+                       this.myName = "まりさ";
 
                        // var xml = this.loadParamsXML("./data/marisa/params.xml");
                        var json = net.load("./data/marisa/params.json");
                        this.param = json.root.param;
+                       if(this.grow == EGrow.BABY){
+                               this.myName = "まりちゃ";
+                               this.param.range /= 4;
+                       }
+                       else if(this.grow == EGrow.CHILD){
+                               this.param.range /= 3;
+                       }
+                       else if(this.grow == EGrow.SUBADULT){
+                               this.param.range *= 0.8;
+                       }
                        this.shadow = new enchant.Sprite(64, 64);
                        this.shadow.image = game.assets[EResPath.YUKKURI_SHADOW];
                        this.shadow.x = 0 + this.x;
@@ -1569,6 +1844,8 @@ 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);
@@ -1612,7 +1889,7 @@ window.onload = function(){
                                if(this.age%10 === 0 && this.age !== 0){
                                        // console.log("palyer:" + this.age);
                                }
-                               this.act();
+                               // this.act();
                                ///////////////////////////////////////////////
                                //Action pattern  debug
                                if(game.input.left){
@@ -1630,6 +1907,8 @@ window.onload = function(){
                                if(game.input.down){
                                        this.moveY(10);
                                }
+
+                               // if(this.age%20 == 0)console.log("player:" + (this.getY() + this.getHeight()/2));
                                ///////////////////////////////////////////////
                                // this.reverse();
                                // if(ctl.backgroundMap.hitTest(this.imgGroup.x, this.imgGroup.y + this.height / 2)){
@@ -1702,14 +1981,12 @@ window.onload = function(){
                backgroundMap.addChild(foodGroup);
                // backgroundMap.addChild(placeGroup);
                var player = new Player(PALYER_INIT_X, PALYER_INIT_Y);
-               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 Marisa(PALYER_INIT_X + 200, PALYER_INIT_Y + 200, EGrow.BABY);
-               // new Marisa(PALYER_INIT_X + 200, PALYER_INIT_Y + 200);
-               // new Marisa(PALYER_INIT_X + 800, PALYER_INIT_Y + 800);
+               // 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 Marisa(PALYER_INIT_X + 200, PALYER_INIT_Y + 200, EGrow.BABY);
                // new Unun(100, 100);
-               // new Place("tree", PALYER_INIT_X, PALYER_INIT_Y - 50);
+               new Place("tree", PALYER_INIT_X, PALYER_INIT_Y - 50);
                var touchX = 0;
 
 
@@ -1730,11 +2007,17 @@ window.onload = function(){
 
 
                game.rootScene.addEventListener('enterframe', function(){
-               //main frame
+                       //main frame
                        mangLabel.draw(player);
+                       if(this.age%BASE_FPS == 0 ){
+                               ctl.calcTime();
+                               console.log("min:" + ctl.min + ":" + ctl.hour + ":" + ctl.day);
+                       }
+                       ctl.time++;
                });
                this.addEventListener('enterframe', function(){
                        //The priority processing of display instead of z-index
+
                        backgroundMap.childNodes.sort(nodeSort);
                });