所以我需要知道我的角色(鸟)用管道命中它是否会在动画结束后播放模具动画需要在主时间轴中通过框架进行游戏
(此代码位于主时间轴图层中)
if (bird.hitTestObject(pipe1)) {
bird.gotoAndStop(3); //frame 3 = where the die animation is
}
LINK 1(这里你看到动画帧3的不同帧是死动画) http://gyazo.com/67381832827bfb8a4dac2452076a4217
LINK 2(模具动画) http://gyazo.com/bf5153a9d00e1478471fff7b73d0c592
所以在这里你可以看到动画结尾的动画需要代码在主时间轴第3帧中转到游戏框架
btw它不是在.as文件中,而是在时间轴
中谢谢你,如果你可以帮助我,如果我的英语不是很好抱歉我的荷兰人
答案 0 :(得分:0)
您可以添加enterframe侦听器并检查动画是否完整。在第3帧中有类似的东西:
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
}
}