var SpriteGroup = enchant.Class.mixClasses(Sprite, Group,true);
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.fps = FPS;
var _loadArr = [];
"myYukkuri": this.yukkuri
});
},
+ walkNew: function(){
+
+ },
walk : function(retryCounter){
if(retryCounter > 15){
retryCounter = 0;
this.yukkuri.vx = 0;
this.yukkuri.vy = 0;
}else{
- // this.isMoving = true;
var xpos = 150 + rand(40) - (retryCounter * 10);
var ypos = 150 + rand(40) - (retryCounter * 10);
if(rand(8) === 0){
};
}
});
+ var WalkEvent = enchant.Class.create(Event,{
+ initialize: function (_data){
+ this.data = _data;
+ this.yukkuri = _data.myYukkuri;
+ this.action = _data.action;
+
+ mangMsg.output(this.yukkuri, EMsg.SLEEP);
+ this.action.setStatus(EAction.SLEEP_WAIT);
+ this.yukkuri.setFaceImage(EFace.SLEEP);
+ this.yukkuri.tlPause();
+ var self = this;
+ this.yukkuri.addEventListener('enterframe', function() {
+ var yukkuri = self.yukkuri;
+ self.run();
+ });
+ },
+ run : function(){
+
+ }
+ });
var SleepEvent = enchant.Class.create(Event,{
initialize: function (_data){
this.data = _data;
this.yukkuri.setFaceImage(EFace.SLEEP);
this.yukkuri.tlPause();
var sec = FPS * 3;
- // this.yukkuri.enterframe(function(){
- // console.log("enterfmrae");
- // });
var self = this;
this.yukkuri.addEventListener('enterframe', function() {
var yukkuri = self.yukkuri;
if(yukkuri.age%2 === 0 && yukkuri.age !== 0)yukkuri.param.sleep--;
if(yukkuri.param.sleep <= 0){
yukkuri.param.sleep = 0;
- self.action.setStatus(EAction.WAIT);
+ this.removeEventListener("enterframe",arguments.callee);
mangMsg.output(self.yukkuri, EMsg.GET_UP);
- self.yukkuri.setFaceImage(EFace.NORMAL);
+ yukkuri.setFaceImage(EFace.NORMAL);
yukkuri.tlResume();
- this.removeEventListener("enterframe",arguments.callee);
+ // self.action.setStatus(EAction.WAIT);
self.action.setStatus(EAction.THINK);
}
});
- },
- onactionstart:function(self){
- return function(e){
- if(typeof e === "undefined")return;
- console.log("astart");
- };
- },
- onactiontick:function(self){
- return function(e){
- if(typeof e === "undefined")return;
- };
- },
- onactionend:function(self){
- return function(e){
- if(typeof e === "undefined")return;
- console.log("enddd");
- };
}
-
- // initialize: function (_data){
- // console.log("init");
- // this.data = _data;
- // this.yukkuri = _data.myYukkuri;
- // this.action = _data.action;
- // this.action.setStatus(EAction.SLEEP_WAIT);
- // mangMsg.output(this.yukkuri, EMsg.SLEEP);
- // this.yukkuri.setFaceImage(EFace.SLEEP);
- // this.yukkuri.tlPause();
-
- // var sec = BASE_FPS * 1;
- // console.log("sec:"+ sec);
- // this.yukkuri.wait(sec, {
- // "onactionstart": this.onactionstart(this),
- // "onactiontick": this.onactiontick(this),
- // "onactionend": this.onactionend(this)
- // });
- // },
- // onactionstart:function(self){
- // return function(e){
- // console.log("start");
- // if(typeof e === "undefined")return;
- // };
- // },
- // onactiontick:function(self){
- // return function(e){
- // if(typeof e === "undefined")return;
- // console.log("tick");
- // var yukkuri = self.yukkuri;
- // if(yukkuri.age%4 === 0 && yukkuri.age !== 0)yukkuri.param.sleep--;
- // if(yukkuri.param.sleep <= 0){
- // yukkuri.param.sleep = 0;
- // }
- // };
- // },
- // onactionend:function(self){
- // return function(e){
- // if(typeof e === "undefined")return;
- // self.action.setStatus(EAction.WAIT);
- // self.yukkuri.setFaceImage(EFace.NORMAL);
- // mangMsg.output(self.yukkuri, EMsg.GET_UP);
- // yukkuri.tlResume();
- // new WaitEvent({
- // "waitframe": FPS * 1.5,
- // "action": self.action,
- // "myYukkuri": self.yukkuri
- // });
- // };
- // }
});
var UnunEvent = enchant.Class.create(Event,{
this.image = game.assets[EResPath.YUKKURI_BASE];
this.direction = EDirection.RIGHT;
this.addEventListener('enterframe', this.runEnterframe);
- this.isSleeping = false;
this.bodyStatus ={};
this.bodyStatus[EBody.NORMAL] = EResPath.YUKKURI_BASE;
this.bodyStatus[EBody.DEAD] = EResPath.YUKKURI_BODY_DEAD;
// console.log("palyer:" + this.age);
}
this.act();
-
///////////////////////////////////////////////
//Action pattern for debug
if(game.input.left){
if(game.input.up){
this.moveY(-10);
this.tweet("ゆっくりしていってね!");
+
}
if(game.input.down){
this.moveY(10);
var menuSurface = new enchant.Surface(EMenuPos.WIDTH, EMenuPos.HEIGHT);
var fieldSurface = new enchant.Surface(EFieldPos.WIDTH, EFieldPos.HEIGHT);
+ var windowSurface = new enchant.Surface(EFieldPos.WIDTH, EFieldPos.HEIGHT);
fieldBg.image = fieldSurface;
fieldBg.x = 0;
fieldBg.y = 0;
+ windowFront.image = windowSurface;
+ windowFront.x = 0;
+ windowFront.y = 0;
+ windowFront.opacity = 0.5;
+
+ 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;
menuBg.x = EMenuPos.X;
menuBg.y = EMenuPos.Y;
-
backgroundMap.addChild(fieldBg);
mangIcon = new MangIcon(ctl, menuBg);
game.rootScene.addChild(backgroundMap);
+ game.rootScene.addChild(windowFront);
game.rootScene.addChild(menuBg);
// var labelGroup = new LabelGroup();
// var food = new def.Food("apple", 200, 250);
backgroundMap.addChild(foodGroup);
var player = new Player(PALYER_INIT_X, PALYER_INIT_Y);
- // new Marisa(PALYER_INIT_X + 200, PALYER_INIT_Y);
+ new Marisa(PALYER_INIT_X + 200, PALYER_INIT_Y);
var touchX = 0;
game.rootScene.addEventListener('touchstart', function (e) {