[英]AS3 how to go to next frame in MainTimeline when character die animation ends
所以我需要知道我的角色(bird)hitTestObject是否帶有管道,他在動畫結束后是否播放死動畫,需要在主時間軸上逐幀播放游戲
if (bird.hitTestObject(pipe1)) {
bird.gotoAndStop(3); //frame 3 = where the die animation is
}
鏈接1(在這里您可以看到動畫的不同幀,第3幀是模具動畫) http://gyazo.com/67381832827bfb8a4dac2452076a4217
LINK 2(骰子動畫) http://gyazo.com/bf5153a9d00e1478471fff7b73d0c592
所以在這里您可以看到動畫的結尾,動畫需要在主時間軸第3幀的框架上進行游戲
順便說一句,它不是在.as文件中,而是在時間軸中
謝謝,如果您能幫助我,如果我的英語不好,我對此感到抱歉
嘗試使用enter frame事件,如下所示:
if (bird.hitTestObject(pipe1)) {
bird.gotoAndStop(3); //frame 3 = where the die animation is
addEventListener(Event.ENTER_FRAME, waitForDeathAnimationToEnd);
}
function waitForDeathAnimationToEnd(e:Event)
{
if(bird.currentFrame === bird.totalFrames)
{
removeEventListener(Event.ENTER_FRAME, waitForDeathAnimationToEnd);
bird.stop();
gotoAndStop(frameOrFrameLabelWhereYourGameOverFrameIs); //Replace with Game Over frame label or number
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.