2014-02-17 27 views
-1

所以我需要知道如果我的角色(鳥)hitTestObject與管道他在動畫結束後播放死亡動畫,它需要在遊戲結束時進入遊戲在主時間軸AS3如何在主時間軸中當角色死亡動畫結束時進入下一幀

(這個碼是在主時間軸層操作)

if (bird.hitTestObject(pipe1)) { 

bird.gotoAndStop(3); //frame 3 = where the die animation is 

} 

LINK 1(在這裏,你看到不同的幀爲動畫幀3是模具動畫) http://gyazo.com/67381832827bfb8a4dac2452076a4217

LINK 2 (di Ë動畫) http://gyazo.com/bf5153a9d00e1478471fff7b73d0c592

所以在這裏你可以看到在動畫的結尾動畫有需要的代碼去遊戲結束幀的主要時間框架3

BTW它不是一個。至於文件,但在時間軸

謝謝你,如果你能幫助我,如果我的英語也不好抱歉,即時通訊荷蘭

回答

0

您可以添加enterFrame事件偵聽器,並檢查是否動畫完成。類似於第三幀:

import flash.events.Event; 
import flash.display.MovieClip; 


var dieClip:MovieClip = this.getChildByName("Snail123fall"); 
//not sure what's the name of your clip but I assume it's something like that 
//if your die animation clip has no name set than name it like that or any way 
//you want and use this name here 

dieClip.addEventListener(Event.ENTER_FRAME, handleEnterFrame) 

private function handleEnterFrame(e:Event):void 
{ 
    if(dieClip.currentFrame == dieClip.totalFrames) 
    { 
     this.gotoAndStop(4);//game over frame  
    } 
} 
相關問題