所以我需要知道我的角色(鸟)用管道命中它是否会在动画结束后播放模具动画需要在主时间轴中通过框架进行游戏
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)
尝试使用输入框架事件,如下所示:
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
}
}