this.player = null;
this.objArray = {};
this.def = null;
+ this.objSprite = null;
},
init : function (game){
this.game = game;
setPlayer: function(player){
this.player = player;
},
+ setCurrentObjSprite: function(objSprite){
+ this.objSprite = objSprite;
+ },
+ getCurrentObjSprite: function(objSprite){
+ return this.objSprite;
+ },
/**
* [setCurrentCommand description]
* @param {ECommand} cmd [description]
touchstart : function(e){
this.touchX = e.x - this.ctl.backgroundMap.x;
this.touchY = e.y - this.ctl.backgroundMap.y;
+ var tx = this.touchX;
+ var ty = this.touchY;
+ var nodes = this.ctl.getObjs();
+ for (var id in nodes) {
+ var node = nodes[id];
+ var nx = node.getX();
+ var ny = node.getY();
+ // if(node.id === undefined)continue;
+ if(node instanceof this.ctl.def.Yukkuri){
+ nx -= node.width / 2;
+ ny -= node.height / 2;
+ }
+ if( nx <= tx
+ && (nx + node.width) >= tx
+ && ny <= ty
+ && (ny + node.height) >= ty
+ ){
+ console.log("hiT!");
+ }
+ }
+
},
touchmove : function(e){
var backgroundMap = this.ctl.backgroundMap;
var labelObj = this.labelParams[key];
labelObj.draw(yukkuriObj);
}
-
}
});
var MangMsg = enchant.Class.create({
break;
case EAction.THINK:
if(this.yukkuri.age%2 === 0){
- if(this.yukkuri.isSleep()){
- this.setStatus(EAction.SLEEP_START);
- }
- else if(this.yukkuri.getUnun() >= 80){
- this.setStatus(EAction.UNUN_START);
- }
- else{
- // this.yukkuri.param.yukkuri -= 1;
- this.yukkuri.changeFace();
- this.search();
- }
+ // if(this.yukkuri.isPlace()){
+
+ // }
+ // else{
+ if(this.yukkuri.isSleep()){
+ this.setStatus(EAction.SLEEP_START);
+ }
+ else if(this.yukkuri.getUnun() >= 80){
+ this.setStatus(EAction.UNUN_START);
+ }
+ else{
+ // this.yukkuri.param.yukkuri -= 1;
+ this.yukkuri.changeFace();
+ this.search();
+ }
+ // }
}
break;
this.id = guid();
ctl.addObj(this);
},
+ getX: function(){
+ return this.x;
+ },
+ getY: function(){
+ return this.y;
+ },
removeAll: function(){
this.remove();
ctl.removeObj(this);
this.y = y - this.height / 2;
backgroundMap.addChild(this);
this.owner = null;
+
// this.addEventListener('enterframe', function(){
// if(this.age%10 === 0 && this.age !== 0){
// console.log("x/y " + this.x + "/" + this.y);
this.place = null;
},
runEnterframe:function(){
+ // this.imgGroup.x = 0;
+ // return ;
this.act();
if(this.isDead())return;
this.runYukkuri();
Yukkuri.call(this,x,y);
this.classname = "Marisa";
-
// var xml = this.loadParamsXML("./data/marisa/params.xml");
var json = net.load("./data/marisa/params.json");
this.param = json.root.param;
this.imgGroup.y = y;
this.animation();
this.action = new Action(this);
- this.id = guid();
ctl.addObj(this);
},
setFaceImage: function(eface){
game.onload = function(){
def.Food = Food;
def.Place = Place;
+ def.ObjSprite = ObjSprite;
+ def.Yukkuri = Yukkuri;
mangTouch = new MangTouch(ctl);
mangMsg = new MangMsg(ctl);
ctl.setDefined(def);
}
var ay = a.y;
var by = b.y;
+
if(a instanceof Place){
ay += Math.round(a.height * 0.7);
}
- else if(b instanceof Place){
+ if(b instanceof Place){
by += Math.round(b.height * 0.7);
}
if(ay < by)return -1;
- if(ay > by)return 1;
+ else if(ay > by)return 1;
+ if(a.id < b.id)return -1;
+ else if(a.id > b.id)return 1;
return 0;
}
);