AS3如何去下一帧中MainTimeline时字模动画结束 [英] AS3 how to go to next frame in MainTimeline when character die animation ends

查看:190
本文介绍了AS3如何去下一帧中MainTimeline时字模动画结束的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我需要知道我的性格(鸟)hitTestObject与管他扮演的模具动画动画后结束它需要去到游戏结束帧中的主要时间

so I need to know if my character(bird) hitTestObject with pipe he plays the die animation after the animation ends it need to go to the game over frame in the main timeline

if (bird.hitTestObject(pipe1)) {

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

}

LINK 1(在这里你看到不同的帧的动画帧3是模具动画) http://gyazo.com/67381832827bfb8a4dac2452076a4217

LINK 1 (here you see different frames for animations frame 3 is die animation) http://gyazo.com/67381832827bfb8a4dac2452076a4217

LINK 2(模具动画) http://gyazo.com/bf5153a9d00e1478471fff7b73d0c592

LINK 2 (the die animation) http://gyazo.com/bf5153a9d00e1478471fff7b73d0c592

所以在这里你可以看到动画在这里需要code去到游戏结束帧中的主要时间框架的动画结束3

so here you can see the animation in the end of the animation there need code to go to game over frame in the main timeline frame 3

BTW它不是一个。至于文件,但在时间线中

btw its not in a .as file but in the timeline

感谢你,如果你能帮助我,如果我的英语不好对不起,即时通讯荷兰

thank you if you can help me and if my english is not good sorry about that im dutch

推荐答案

尝试使用一个输入框的事件,就像这样:

Try using an enter frame event, like so:

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
    }
}

这篇关于AS3如何去下一帧中MainTimeline时字模动画结束的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆