2 //////////////////////////////////////
9 var LabelGroup = enchant.Class.mixClasses(Label, Group,true);
11 //////////////////////////////////////
13 //////////////////////////////////////
14 var PALYER_INIT_X = 100;
15 var PALYER_INIT_Y = 100;
17 var CHARA_HEIGHT = 64;
19 var GAME_HEIGHT = 600;
24 YUKKURI_BASE : './data/yukkuri_base.png',
25 YUKKURI_SHADOW : './data/shadow.png',
26 MARISA_FACE_NORMAL : './data/marisa/face_normal1.png',
27 MARISA_FACE_TIRED : './data/marisa/face_tired1.png',
28 MARISA_FACE_ANGRY : './data/marisa/face_angry1.png',
29 MARISA_FACE_CRY1 : './data/marisa/face_cry1.png',
30 MARISA_FACE_CRY2 : './data/marisa/face_cry2.png',
31 MARISA_FACE_EAT1 : './data/marisa/face_eat1.png',
32 MARISA_FACE_EAT2 : './data/marisa/face_eat2.png',
33 MARISA_FACE_HAPPY1 : './data/marisa/face_happy1.png',
34 MARISA_FACE_HAPPY2 : './data/marisa/face_happy2.png',
35 MARISA_FACE_SLEEP : './data/marisa/face_sleep1.png',
36 MARISA_HEAR : './data/marisa/hear1.png',
37 OBJECT : './data/object.png',
38 MAP0 : './data/map0.png',
39 COMMAND : './data/command.png',
40 OKAZARI : './data/okazari.png',
69 WIDTH: GAME_WIDTH - EMenuPos.WIDTH,
81 MOVE_TO_EAT_START: 10,
82 MOVE_TO_EAT_UNDERWAY: 11,
95 window.onload = function(){
97 var def = new Object();
98 var foodGroup = new Group();
99 var SpriteGroup = enchant.Class.mixClasses(Sprite, Group,true);
100 var menuBg = new SpriteGroup(EMenuPos.WIDTH, EMenuPos.HEIGHT);
101 var fieldBg = new enchant.Sprite(EFieldPos.WIDTH, EFieldPos.HEIGHT);
102 var game = new Game(GAME_WIDTH, GAME_HEIGHT);
106 for(var _v in EResPath){
107 _loadArr[i] = EResPath[_v];
110 game.preload(_loadArr);
111 var MapGroup = enchant.Class.mixClasses(Map, Group,true);
112 var backgroundMap = new MapGroup(16, 16);
113 include("./class.js");
114 include("./ctrl.js");
117 ctl.setBackgroundMap(backgroundMap);
118 var Action = enchant.Class.create({
119 initialize: function (yukkuri){
120 this.status = EAction.THINK;
121 this.yukkuri = yukkuri;
122 this.isMoving = false;
123 this.targetNode = null;
125 setStatus: function(eaction){
126 this.status = eaction;
129 if(this.yukkuri.isDead()){
130 this.status = EAction.DEAD;
132 if(this.yukkuri.isSleep()){
133 this.status = EAction.SLEEP;
141 if(this.yukkuri.age%2 === 0){
142 this.yukkuri.changeFace();
146 case EAction.MOVE_TO_EAT_START:
147 this.move_to_eat_start();
149 case EAction.MOVE_TO_EAT_UNDERWAY:
161 case EAction.EAT_START:
164 case EAction.EAT_WAIT:
166 case EAction.MOVE_TO_COMMAND:
167 this.move_to_command();
172 move_to_eat_start : function(){
175 "targetNode": this.targetNode,
177 "myYukkuri": this.yukkuri
180 walk : function(retryCounter){
181 if(retryCounter > 15){
183 this.status = EAction.NONE;
184 console.log("retryCount over");
187 if(this.yukkuri.imgGroup.tl.queue.length === 0){
190 this.isMoving = false;
191 this.status = EAction.THINK;
195 // this.isMoving = true;
196 var xpos = 150 - (retryCounter * 10);
197 var ypos = 150 - (retryCounter * 10);
200 this.yukkuri.vy = -ypos;
202 else if(rand(8) == 1){
203 this.yukkuri.vx = xpos;
204 this.yukkuri.vy = -ypos;
205 this.yukkuri.direction = EDirection.RIGHT;
207 else if(rand(8) == 2){
208 this.yukkuri.vx = xpos;
210 this.yukkuri.direction = EDirection.RIGHT;
212 else if(rand(8) == 3){
213 this.yukkuri.vx = xpos;
214 this.yukkuri.vy = ypos;
215 this.yukkuri.direction = EDirection.RIGHT;
217 else if(rand(8) == 4){
219 this.yukkuri.vy = ypos;
221 else if(rand(8) == 5){
222 this.yukkuri.vx = -xpos;
223 this.yukkuri.vy = ypos;
224 this.yukkuri.direction = EDirection.LEFT;
226 else if(rand(8) == 6){
227 this.yukkuri.vx = -xpos;
229 this.yukkuri.direction = EDirection.LEFT;
231 else if(rand(8) == 7){
232 this.yukkuri.vx = -xpos;
233 this.yukkuri.vy = -ypos;
234 this.yukkuri.direction = EDirection.LEFT;
236 if (this.yukkuri.vx || this.yukkuri.vy) {
237 var map = ctl.backgroundMap;
238 // var x = this.yukkuri.x + (this.yukkuri.moveX ? this.yukkuri.moveX / Math.abs(this.yukkuri.moveX) * 16 : 0) + 16;
239 // var y = this.yukkuri.y + (this.yukkuri.moveY ? this.yukkuri.moveY / Math.abs(this.yukkuri.moveY) * 16 : 0) + 16;
240 var x = this.yukkuri.imgGroup.x + this.yukkuri.vx;
241 var y = this.yukkuri.imgGroup.y + this.yukkuri.vy + this.yukkuri.height / 2;
242 if (0 <= x && x < map.width && 0 <= y && y < map.height && !map.hitTest(x, y)) {
243 // console.log("あたってないよ:"+ this.yukkuri.imgGroup.x + ":" + this.yukkuri.imgGroup.y);
244 // console.log("X:" + this.yukkuri.moveX);
245 // console.log("Y:" + this.yukkuri.moveY);
246 this.isMoving = true;
247 this.yukkuri.reverse();
248 this.yukkuri.moveBy(this.yukkuri.vx, this.yukkuri.vy, frame);
249 mangMsg.output(this.yukkuri,EMsg.WALK);
251 // console.log("HIT:"+ this.yukkuri.imgGroup.x + ":" + this.yukkuri.imgGroup.y);
252 this.walk(retryCounter+1);
259 var yukkuri = this.yukkuri;
261 if(yukkuri.isSleeping){
262 if(yukkuri.age%4 === 0 && yukkuri.age !== 0)yukkuri.param.sleep--;
263 if(yukkuri.param.sleep <= 0){
264 yukkuri.param.sleep = 0;
265 yukkuri.isSleeping = false;
266 yukkuri.tweet("ゆっくりおきるよ!");
267 this.status = EAction.THINK;
268 yukkuri.imgBody.tl.resume();
269 yukkuri.imgGroup.tl.resume();
271 yukkuri.face.image = game.assets[EResPath.MARISA_FACE_NORMAL];
276 this.yukkuri.tweet("もっとゆっくりしたかった…");
277 this.yukkuri.imgBody.tl.clear();
278 this.yukkuri.imgBody.tl.pause();
279 this.yukkuri.imgGroup.tl.clear();
280 this.yukkuri.imgGroup.tl.pause();
282 eat_start: function(){
285 "targetNode": this.targetNode,
287 "myYukkuri": this.yukkuri
291 move_to_command: function(){
295 var nodes = ctl.getObjs();
296 // l = game.rootScene.childNodes.length;
297 // l = game.rootScene.childNodes.length;
299 // for (var i = 0; i < l; i++) {
300 for (var key in nodes) {
301 var node = nodes[key];
302 if (node instanceof Food) {
303 if(this.yukkuri.isKuhuku() && this.yukkuri.within(node, this.yukkuri.getRange())){
305 //A yukkuri to go to the food area
306 this.targetNode = node;
307 this.setStatus(EAction.MOVE_TO_EAT_START);
311 //not hunbry or not food.
315 this.status = EAction.WALK;
318 var Event = enchant.Class.create({
319 initialize: function (_data){
321 onactionstart:function(self){
323 if(typeof e === "undefined")return;
326 onactiontick:function(self){
328 if(typeof e === "undefined")return;
331 onactionend:function(self){
333 if(typeof e === "undefined")return;
338 var EatEvent = enchant.Class.create(Event,{
339 initialize: function (_data){
341 this.yukkuri = _data.myYukkuri;
342 this.food = _data.targetNode;
343 this.action = _data.action;
344 this.action.setStatus(EAction.EAT_WAIT);
345 this.yukkuri.tweet("む~しゃむ~しゃ!それなり~");
346 mangMsg.output(this.yukkuri, EMsg.EAT);
347 this.yukkuri.setFaceImage(EFace.EAT2);
348 // this.yukkuri.image = game.assets[EResPath.MARISA_];
350 // var sec = FPS * (this.yukkuri.param.hungry/10 + 3);
353 this.yukkuri.wait(sec, {
354 "onactionstart": this.onactionstart(this),
355 "onactiontick": this.onactiontick(this),
356 "onactionend": this.onactionend(this)
359 onactionstart:function(self){
361 if(typeof e === "undefined")return;
362 self.yukkuri.eat(self.food);
365 onactiontick:function(self){
367 if(typeof e === "undefined")return;
370 onactionend:function(self){
372 if(typeof e === "undefined")return;
373 if(self.food.getAmount() <= 0 || self.yukkuri.isManpuku()){
374 self.action.setStatus(EAction.THINK);
375 self.yukkuri.setFaceImage(EFace.NORMAL);
377 self.action.setStatus(EAction.EAT_START);
384 * -When yukkuri find Food.
387 * targetNode: enchant.Node
391 var MoveToEatEvent = enchant.Class.create(Event,{
392 initialize: function (_data){
394 this.yukkuri = this.data.myYukkuri;
395 this.action = this.data.action;
397 var yukkuri = this.yukkuri;
398 var node = this.data.targetNode;
400 if(this.data.type == "food"){
401 this.action.status = EAction.MOVE_TO_EAT_UNDERWAY;
402 yukkuri.vx = node.x - yukkuri.getX();
403 yukkuri.vy = node.y - yukkuri.getY();
404 var distance = (Math.abs(yukkuri.vx) + Math.abs(yukkuri.vy)) / 2;
405 var frame = distance + distance/5 + 1;
406 yukkuri.direction = yukkuri.vx > 0 ? EDirection.RIGHT : EDirection.LEFT;
408 yukkuri.moveBy(yukkuri.vx, yukkuri.vy, frame, {
409 "onactionstart": this.onactionstart(this),
410 "onactiontick": this.onactiontick(this),
411 "onactionend": this.onactionend(this)
415 onactionstart:function(self){
417 if(typeof e === "undefined")return;
418 console.log("moveEvent onactionstart");
419 self.yukkuri.tweet("ゆゆ??\nたべものさん\nはっけんなのぜ!");
422 onactiontick:function(self){
424 if(typeof e === "undefined")return;
427 onactionend:function(self){
429 if(typeof e === "undefined")return;
430 self.action.setStatus(EAction.EAT_START);
434 var MoveCommandEvent = enchant.Class.create(Event,{
435 initialize: function (_data){
437 this.yukkuri = this.data.myYukkuri;
438 this.action = this.data.action;
439 this.vx = this.data.vx;
440 this.vy = this.data.vy;
442 var yukkuri = this.yukkuri;
443 this.action.status = EAction.MOVE_TO_EAT_UNDERWAY;
444 yukkuri.vx = node.x - yukkuri.getX();
445 yukkuri.vy = node.y - yukkuri.getY();
446 var distance = (Math.abs(yukkuri.vx) + Math.abs(yukkuri.vy)) / 2;
447 var frame = distance + 1;
448 yukkuri.moveBy(yukkuri.vx, yukkuri.vy, frame, {
449 "onactionstart": this.onactionstart(this),
450 "onactiontick": this.onactiontick(this),
451 "onactionend": this.onactionend(this)
454 onactionstart:function(self){
456 if(typeof e === "undefined")return;
459 onactiontick:function(self){
461 if(typeof e === "undefined")return;
464 onactionend:function(self){
466 if(typeof e === "undefined")return;
467 self.action.setStatus(EAction.THINK);
472 var ObjSprite = enchant.Class.create(enchant.Sprite,{
473 initialize: function (w, h){
474 enchant.Sprite.call(this, w, h);
478 removeAll: function(){
484 var Food = enchant.Class.create(ObjSprite,{
485 initialize: function (type, x, y){
486 this.classname = "Food";
487 ObjSprite.call(this,16,16);
488 this.image = game.assets[EResPath.OBJECT];
492 //一つにつきgiveの値分、hunguryを減少させられる
495 // backgroundMap.addChild(this);
496 foodGroup.addChild(this);
497 this.addEventListener('enterframe', function(){
498 if(this.amount <= 0){
503 getAmount: function(){
510 var Okazari = enchant.Class.create(enchant.Sprite,{
511 initialize: function(){
512 this.classname = "Okazari";
513 enchant.Sprite.call(this, 64, 64);
514 this.image = game.assets[EResPath.OKAZARI];
515 this.x = -CHARA_WIDTH / 2;
516 this.y = -12 - CHARA_HEIGHT / 2;
519 var Yukkuri = enchant.Class.create(ObjSprite,{
520 initialize: function(x, y){
521 ObjSprite.call(this, 64, 64);
522 this.classname = "Yukkuri";
523 this.imgGroup = new SpriteGroup();
524 this.imgBody = new SpriteGroup();
525 this.imgGroup.id = guid();
526 this.imgBody.id = guid();
527 this.x = -CHARA_WIDTH / 2;
528 this.y = -CHARA_HEIGHT / 2;
531 this.image = game.assets[EResPath.YUKKURI_BASE];
532 this.direction = EDirection.RIGHT;
533 this.addEventListener('enterframe', this.runEnterframe);
534 this.isSleeping = false;
536 runEnterframe:function(){
543 if(this.direction == EDirection.RIGHT){
544 this.imgBody.scaleX = 1;
546 else if(this.direction == EDirection.LEFT){
547 this.imgBody.scaleX = -1;
550 tweet:function(text){
551 this._tweet.text(text, this.x - this._tweet.width/4, this.y - this._tweet.height);
553 moveTo:function(x, y, time){
554 this.imgGroup.tl.moveTo(x, y, time, enchant.Easing.SIN_EASEINOUT);
556 moveBy:function(x, y, time, eventFunctions){
560 return self.imgGroup.x + x;
563 return self.imgGroup.y + y;
566 easing: enchant.Easing.SIN_EASEINOUT
568 //-Event register [onactionstart,onactiontick,onactionend]
569 if(eventFunctions !== undefined){
570 for(var key in eventFunctions){
571 params[key] = eventFunctions[key];
574 this.imgGroup.tl.tween(params);
577 wait:function(frame, eventFunctions){
578 this.moveBy(0,1,frame,eventFunctions);
583 animation: function(){
584 this.imgBody.tl.moveBy(0, -5, 10, enchant.Easing.SWING).moveBy(0, 5, 10, enchant.Easing.SWING).loop();
585 // this.tl.moveBy(0, -5, 10, enchant.Easing.SWING).moveBy(0, 5, 10, enchant.Easing.SWING).loop();
586 // this.okazari.tl.moveBy(0, -5, 10, enchant.Easing.SWING).moveBy(0, 5, 10, enchant.Easing.SWING).loop();
587 // this.face.tl.moveBy(0, -5, 10, enchant.Easing.SWING).moveBy(0, 5, 10, enchant.Easing.SWING).loop();
588 // this.hear.tl.moveBy(0, -5, 10, enchant.Easing.SWING).moveBy(0, 5, 10, enchant.Easing.SWING).loop();
591 return this.imgGroup.x;
594 return this.imgGroup.y;
597 this.imgGroup.x += x;
599 // this.shadow.x += x;
600 // this._tweet.x += x;
603 this.imgGroup.y += y;
605 // this.shadow.y += y;
606 // this._tweet.y += y;
608 // changeFace: function(erespath){
609 // this.face.image = game.assets[erespath];
611 loadParamsXML: function(url){
612 var http = new JKL.ParseXML( url );
615 runYukkuri: function(){
616 if(this.param.hungry > 70){
617 if(this.age%(50 - this.param.hungry - 70) === 0 && this.age !== 0){
618 this.param.yukkuri -= 1;
621 else if(this.param.hungry < 10){
622 if(this.age%50 === 0 && this.age !== 0) this.param.yukkuri += 1;
625 if(this.param.yukkuri <= 0)this.param.yukkuri = 0;
626 else if(this.param.yukkuri >= this.param.maxYukkuri)this.param.yukkuri = this.param.maxYukkuri;
628 runHungry: function(){
629 if(this.age%50 === 0 && this.age !== 0)this.param.hungry++;
630 if(this.param.hungry >= 100)this.param.hungry = 100;
632 runSleep: function(){
633 if(!this.isSleeping){
634 if(this.age%100 === 0 && this.age !== 0)this.param.sleep++;
635 if(this.param.sleep >= 100){
636 this.param.sleep = 100;
637 this.isSleeping = true;
638 this.tweet("zzz...zzz...zzz...");
639 this.imgBody.tl.pause();
640 this.imgGroup.tl.pause();
641 this.imgBody.tl.clear();
642 this.imgGroup.tl.clear();
643 this.face.image = game.assets[EResPath.MARISA_FACE_SLEEP];
649 changeFace: function(){
650 if(this.param.yukkuri >= 80){
651 this.setFaceImage(EFace.HAPPY1);
653 else if(this.param.yukkuri >= 50){
654 this.setFaceImage(EFace.NORMAL);
656 else if(this.param.yukkuri >= 30){
657 this.setFaceImage(EFace.TIRED);
659 else if(this.param.yukkuri >= 10){
660 this.setFaceImage(EFace.CRY1);
662 else if(this.param.yukkuri >= 1){
663 this.setFaceImage(EFace.CRY2);
666 getRange: function(){
667 return this.param.range;
670 return this.isSleeping;
673 return this.param.yukkuri <= 0;
675 isManpuku: function(){
676 return this.param.hungry <= 20;
678 isKuhuku: function(){
679 return this.param.hungry >= 40;
681 getHungry: function(){
682 return this.param.hungry;
684 setHungry: function(hungry){
685 this.param.hungry = hungry;
686 if(this.param.hungry < 0)this.param.hungry = 0;
690 this.setHungry(this.param.hungry - food.getGive());
692 destruct: function(){
696 var Marisa = enchant.Class.create(Yukkuri,{
697 initialize: function(x, y){
698 Yukkuri.call(this,x,y);
699 this.classname = "Marisa";
702 // var xml = this.loadParamsXML("./data/marisa/params.xml");
703 var json = net.load("./data/marisa/params.json");
704 this.param = json.root.param;
705 this.shadow = new enchant.Sprite(64, 64);
706 this.shadow.image = game.assets[EResPath.YUKKURI_SHADOW];
707 this.shadow.x = 0 + this.x;
708 this.shadow.y = CHARA_HEIGHT / 16 + this.x;
709 this.shadow.image._element.style.zIndex = 2;
711 this._style.zIndex = 5;
713 this.face = new enchant.Sprite(64, 64);
714 this.face.image = game.assets[EResPath.MARISA_FACE_NORMAL];
715 this.face.x = -CHARA_WIDTH / 2;
716 this.face.y = -CHARA_HEIGHT / 2;
717 this.face._style.zIndex = 0;
720 this.faceStatus[EFace.NORMAL] = EResPath.MARISA_FACE_NORMAL;
721 this.faceStatus[EFace.CRY1] = EResPath.MARISA_FACE_CRY1;
722 this.faceStatus[EFace.CRY2] = EResPath.MARISA_FACE_CRY2;
723 this.faceStatus[EFace.ANGRY] = EResPath.MARISA_FACE_ANGRY;
724 this.faceStatus[EFace.HAPPY1] = EResPath.MARISA_FACE_HAPPY1;
725 this.faceStatus[EFace.HAPPY2] = EResPath.MARISA_FACE_HAPPY2;
726 this.faceStatus[EFace.EAT1] = EResPath.MARISA_FACE_EAT1;
727 this.faceStatus[EFace.EAT2] = EResPath.MARISA_FACE_EAT2;
728 this.faceStatus[EFace.TIRED] = EResPath.MARISA_FACE_TIRED;
729 this.faceStatus[EFace.SLEEP] = EResPath.MARISA_FACE_SLEEP;
732 this.hear = new enchant.Sprite(64, 64);
733 this.hear.image = game.assets[EResPath.MARISA_HEAR];
734 this.hear.x = -CHARA_WIDTH / 2;
735 this.hear.y = -CHARA_HEIGHT / 2;
736 this.hear._style.zIndex = 0;
738 this.okazari = new Okazari();
739 this.okazari.image._element.style.zIndex = 1;
741 // this.imgGroup._style.zIndex = 1;
743 this.imgGroup.addChild(this.shadow);
744 this.imgBody.addChild(this);
745 this.imgBody.addChild(this.face);
746 this.imgBody.addChild(this.hear);
747 this.imgBody.addChild(this.okazari);
748 this.imgGroup.addChild(this.imgBody);
749 backgroundMap.addChild(this.imgGroup);
750 this._tweet = new TTweet(148, 64);
751 this._tweet.image._element.style.zIndex = 20;
753 this.imgGroup.addChild(this._tweet);
757 this.action = new Action(this);
761 setFaceImage: function(eface){
762 var path = this.faceStatus[eface];
763 this.face.image = game.assets[path];
766 var Player = enchant.Class.create(Marisa,{
767 initialize: function(x, y){
768 // this.runEnterframe = function(){
770 Marisa.call(this, x, y);
771 this.classname = "Player";
773 // this.removeEventListener('enterframe',this.runEnterframe);
774 this.addEventListener('enterframe', function(){
775 if(this.age%10 === 0 && this.age !== 0){
776 // console.log("palyer:" + this.age);
780 ///////////////////////////////////////////////
781 //Action pattern for debug
783 // this.changeFace(EResPath.MARISA_FACE_TIRED);
785 this.direction = EDirection.LEFT;
787 if(game.input.right){
789 this.direction = EDirection.RIGHT;
793 this.tweet("ゆっくりしていってね!");
798 ///////////////////////////////////////////////
800 // if(ctl.backgroundMap.hitTest(this.imgGroup.x, this.imgGroup.y + this.height / 2)){
801 // console.log("hit:" + this.imgGroup.x + ":" + (this.imgGroup.y + this.height/2) );
803 // console.log("not:" + this.imgGroup.x + ":" + (this.imgGroup.y + this.image.height/2));
805 //- Display the circle of search range.
806 // fieldBg.image.clear();
807 // fieldBg.image.context.beginPath();
808 // fieldBg.image.context.fillStyle = '#ff0000';
809 // fieldBg.image.context.arc(this.imgGroup.x + this.width/2, this.imgGroup.y + this.height/2, this.range, Math.PI * 2, false);
810 // fieldBg.image.context.fill();
814 game.onload = function(){
816 mangTouch = new MangTouch(ctl);
817 mangMsg = new MangMsg(ctl);
819 backgroundMap.image = game.assets[EResPath.MAP0];
820 backgroundMap.loadData(_mapData);
821 backgroundMap.collisionData = _collisionData;
823 var menuSurface = new enchant.Surface(EMenuPos.WIDTH, EMenuPos.HEIGHT);
824 var fieldSurface = new enchant.Surface(EFieldPos.WIDTH, EFieldPos.HEIGHT);
825 fieldBg.image = fieldSurface;
829 menuSurface.context.fillStyle = '#000';
830 menuSurface.context.fillRect(0, 0, EMenuPos.WIDTH, EMenuPos.HEIGHT);
831 menuBg.image = menuSurface;
832 menuBg.x = EMenuPos.X;
833 menuBg.y = EMenuPos.Y;
835 backgroundMap.addChild(fieldBg);
836 mangIcon = new MangIcon(ctl, menuBg);
838 game.rootScene.addChild(backgroundMap);
839 game.rootScene.addChild(menuBg);
841 // var labelGroup = new LabelGroup();
842 mangLabel = new MangLabel(ctl, menuBg);
843 // var info = new Label("ゆっくり");
844 // info.color = "#ffffff";
845 // info.font = "14px 'Times New Roman'";
847 // info.y = GAME_HEIGHT / 2;
848 // labelGroup.addChild(info);
849 // menuBg.addChild(labelGroup);
852 // var food = new def.Food("apple", 200, 250);
853 backgroundMap.addChild(foodGroup);
854 var player = new Player(PALYER_INIT_X, PALYER_INIT_Y);
855 new Marisa(PALYER_INIT_X + 200, PALYER_INIT_Y);
858 game.rootScene.addEventListener('touchstart', function (e) {
860 var mang = mangTouch.get(ctl.getCurrentCommand());
863 game.rootScene.addEventListener('touchmove', function (e) {
864 var mang = mangTouch.get(ctl.getCurrentCommand());
867 game.rootScene.addEventListener('touchend', function (e) {
868 var mang = mangTouch.get(ctl.getCurrentCommand());
870 game.touched = false;
874 game.rootScene.addEventListener('enterframe', function(){
876 mangLabel.draw(player);
879 this.addEventListener('enterframe', function(){
880 //The priority processing of display instead of z-index
881 backgroundMap.childNodes.sort(
883 if(typeof a.id === "undefined" && typeof b.id === "undefined"){
886 else if(typeof a.id === "undefined"){
889 else if(typeof b.id === "undefined"){
892 if(a.y < b.y)return -1;
893 if(a.y > b.y)return 1;