播放影片剪辑一帧一帧在additon后,同样的功能被执行多次 [英] Play MovieClip frame by frame in additon after same function is executed several times

查看:165
本文介绍了播放影片剪辑一帧一帧在additon后,同样的功能被执行多次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能是一个pretty的基本问题,但我仍然在学习。我有一个影片剪辑名为fails_mc,它由3个足球和我的比赛每一个我的球员未能我需要添加一个X标记超过1球的时候,我有一个hitTestObject检测时,球击中球门区,但球去外面,我需要打1帧fails_mc内,并添加X标记,以一球(我有内部fails_mc,1对每帧3个不同的PNG文件),这是code我用,但我不知道如何通过帧开始播放帧的fails_mc(记住,相同功能将每次使用的,这就是为什么每帧必须被添加到最后一个播放的帧

Probably a pretty basic question but I’m still learning. I have a MovieClip named fails_mc, it consists of 3 soccer balls and in my game every time my player fails I need to add an X mark over 1 ball, I have a hitTestObject detecting when the ball hits the goal area, but when the ball goes outside I need to play 1 frame inside the fails_mc and add the X mark to a ball ( I have 3 different png files inside fails_mc, 1 on each frame), this is the code I’m using but I don’t know how to play frame by frame the fails_mc (keep in mind that the same function will be used every time, that’s why each frame must be added to the last played frame:

if (ball.hitTestObject(goalie))
{

    goal_mc.play();
    net_mc.play();

}
else
{
    fails_mc.play(+=1); // This is not working

    trace("It’s a fail");


}

3失败

在我必须触发,将完成游戏的另一个功能,但我会弄清楚如何做到这一点以后。

After 3 fails I must trigger another function that will finish the game but I will figure out how to do that later on.

感谢了很多的好朋友!帮助将大大AP preciated。

Thanks a lot pals! Help will be greatly appreciated.

推荐答案

我认为所有你想找的是一个影片剪辑的nextFrame()函数。

I think all your looking for is the nextFrame() function of a movieClip.

您也可以使用gotoAndStop(X1) - 在X1是你想要的电影剪辑,转到帧标签(或号码,如果没有引号)。你可以使用一个变量来跟踪当前的状态。

you could also use gotoAndStop("x1") - where "x1" is the frame label (or number if not in quotes) you want the movieClip to goto. You could use a variable to track the current state.

var misses:int = 0;

if (ball.hitTestObject(goalie))
{

    goal_mc.play();
    net_mc.play();

}
else
{
    misses++;
    trace("It’s a fail");

    if(misses > 3){
        //do your game over stuff
    }else{
        fails_mc.gotoAndStop(misses)
    }
}

这篇关于播放影片剪辑一帧一帧在additon后,同样的功能被执行多次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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