From: nagoling <> Date: Sun, 29 Dec 2013 20:45:50 +0000 (+0900) Subject: update X-Git-Url: http://git.osdn.net/view?p=yukkurioverwint%2FYukkuriOverwinter.git;a=commitdiff_plain;h=34c20749185d241119700e8fbce6831e3e42c7f4 update --- diff --git a/lib/Animation.js b/lib/Animation.js index 0760b69..ceeacf0 100644 --- a/lib/Animation.js +++ b/lib/Animation.js @@ -1,28 +1,50 @@ var Animation = enchant.Class.create({ initialize: function (sprite){ this.cnt = 0; + this.cntUp = 0; + this.cntDown = 0; + this.accCnt = 0; this.maxY = -4; this.minY = 0; this.y = 0; this.speed = 0.5; this.sprite = sprite; this.status = EAnimStatus.UP; + this.stop = false; + }, - animrun: function(){ + runAnim: function(){ if(this.cnt <= this.maxY){ this.status = EAnimStatus.DOWN; } else if(this.cnt >= this.minY){ this.status = EAnimStatus.UP; - } + if(this.stop)return; if(this.status == EAnimStatus.UP){ this.sprite.y -= this.speed; this.cnt -= this.speed; + this.cntUp -= this.speed; } else if(this.status == EAnimStatus.DOWN){ this.sprite.y += this.speed; this.cnt += this.speed; + this.cntDown += this.speed; } - } + if(this.cnt != (this.cntUp + this.cntDown)){ + console.log(this.cnt + "@" + this.cntUp + ":" + this.cntDown); + } + // console.log(this.cnt); + }, + startAnim:function(){ + // console.log("start:" + this.cnt); + this.stop = false; + }, + stopAnim: function(){ + this.sprite.y -= this.cnt; + this.cntUp = 0; + this.cntDown = 0; + this.cnt = 0; + this.stop = true; + }, }); \ No newline at end of file diff --git a/lib/FormSprite.js b/lib/FormSprite.js index c4fd3ef..4714892 100644 --- a/lib/FormSprite.js +++ b/lib/FormSprite.js @@ -3,6 +3,7 @@ var FormSprite = enchant.Class.create({ this.spriteArray = []; this.id = guid(); this.mainIndex = 0; + this.shadowIndex = 0; }, addChild:function(sprite, index, attr){ this.add(sprite, index, attr); @@ -24,8 +25,10 @@ var FormSprite = enchant.Class.create({ // }, /** attr: - mainIndex:true/false + mainIndexFlg:true/false + shadowIndexFlg:true/false type:body/tweet + */ add : function(sprite, index, attr){ if(attr === undefined)attr = {}; @@ -36,6 +39,9 @@ var FormSprite = enchant.Class.create({ if(attr.mainIndexFlg){ this.mainIndex = index; } + if(attr.shadowIndexFlg){ + this.shadowIndex = index; + } // this.spriteArray.push(sprite); }, remove: function (sprite){ @@ -55,6 +61,15 @@ var FormSprite = enchant.Class.create({ spr.y += y; } }, + getMainSprite: function(){ + return this.spriteArray[this.mainIndex]; + }, + getShadowSprite: function(){ + return this.spriteArray[this.shadowIndex]; + }, + getMainShadowMarginY: function(){ + return Math.round(this.getMainSprite().y - this.getShadowSprite().y); + }, getX: function(){ return Math.round(this.spriteArray[this.mainIndex].x,2) - this.spriteArray[this.mainIndex].baseX; }, @@ -75,6 +90,15 @@ var FormSprite = enchant.Class.create({ spr.y = y + spr.baseY; } }, + addBodyY: function(y){ + for(var i=0;i 0){ + this.addBodyY(-1); + } + for(var i=0;i= 80){ + yukkuri.action.setStatus(EAction.UNUN_START); + return; + } if(yukkuri.isItemsMax() && yukkuri.isPlace()){ yukkuri.action.targetNode = yukkuri.getPlace(); @@ -978,15 +986,6 @@ window.onload = function(){ 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()){ @@ -2042,7 +2041,8 @@ window.onload = function(){ this.runUnun(); this.runSleep(); this.runAddress(); - this.formSprite.animation(); + this.runAnimation(); + // this.animation(); } // }catch(e){ @@ -2109,9 +2109,11 @@ window.onload = function(){ act: function(){ this.action.act(); }, - + runAnimation: function(){ + this.formSprite.formRunAnimation(); + }, animation: function(){ - this.formSprite.animation(); + this.formSprite.formStartAnimation(); // var frame = 10; // frame -= plusFrameScale(frame, this.getMyScale()) / 2; // var move = 5; @@ -2196,7 +2198,7 @@ window.onload = function(){ }, 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; } @@ -2345,7 +2347,7 @@ window.onload = function(){ // this.imgBody.tl.unloop(); // this.imgGroup.tl.unloop(); // this.imgBody.y = 0; - + this.formSprite.formStopAnimation(); }, tlResume: function(){ // this.imgBody.tl.resume(); @@ -2618,7 +2620,7 @@ window.onload = function(){ this.kukis[3] = new Kuki(this, -5, 5); this._tweet = new TTweet(this, 148, 64); - this.formSprite.addChild(this.shadow,0,{type:"shadow",scaleValue:this.myScaleY}); + this.formSprite.addChild(this.shadow,0,{type:"shadow",shadowIndexFlg:true,scaleValue:this.myScaleY}); this.formSprite.addChild(this, 1, { mainIndexFlg:true, type : "body", @@ -2901,7 +2903,7 @@ window.onload = function(){ // 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 + 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); diff --git a/php/lib/Animation.js b/php/lib/Animation.js deleted file mode 100644 index 0760b69..0000000 --- a/php/lib/Animation.js +++ /dev/null @@ -1,28 +0,0 @@ -var Animation = enchant.Class.create({ - initialize: function (sprite){ - this.cnt = 0; - this.maxY = -4; - this.minY = 0; - this.y = 0; - this.speed = 0.5; - this.sprite = sprite; - this.status = EAnimStatus.UP; - }, - animrun: function(){ - if(this.cnt <= this.maxY){ - this.status = EAnimStatus.DOWN; - } - else if(this.cnt >= this.minY){ - this.status = EAnimStatus.UP; - - } - if(this.status == EAnimStatus.UP){ - this.sprite.y -= this.speed; - this.cnt -= this.speed; - } - else if(this.status == EAnimStatus.DOWN){ - this.sprite.y += this.speed; - this.cnt += this.speed; - } - } -}); \ No newline at end of file diff --git a/php/lib/FormSprite.js b/php/lib/FormSprite.js deleted file mode 100644 index 0f289c6..0000000 --- a/php/lib/FormSprite.js +++ /dev/null @@ -1,143 +0,0 @@ -var FormSprite = enchant.Class.create({ - initialize: function (){ - this.spriteArray = []; - this.id = guid(); - this.mainIndex = 0; - }, - addChildAll:function(){ - for(var i=0;i