0
votes

I'm a total newbie at flash.

I'm on flash CS6, and action script 2.0. What I'm trying to do, is make it so that when a movie clip (bird_mc) collides with another movie clip (missile_mc), then the movie jumps to a later frame.

My script below doesn't include missile_mc, and this is surely a problem, so how do I get these two movie clips to when touch move the movie to another frame?

The bird_mc has action script to move up and down with the up and down arrow keys, and the action script below is connected to frame 1.

Please help, I have no idea what is required to make this work, as I am a beginner! My action script may be all completely wrong, so anything new or any edition of mine is great.

Here is the action script on frame 1:

if (_root.bird_mc.hitTest(_x, _y, true)) {
_root.gotoAndStop(2);
}
1
Is the code above in the main timeline, or in one of your MovieClips?helloflash

1 Answers

0
votes

If your movieClips and your actionScript code are all in frame 1:

this.onEnterFrame = function():Void { 
    if (bird_mc.hitTest(missile_mc._x, missile_mc._y, true)) {
        gotoAndStop(2);
    }
}

If you put your code within the movieclip missile_mc:

this.onEnterFrame = function():Void { 
    if (_parent.bird_mc.hitTest(_x, _y, true)) {
        _parent.gotoAndStop(2);
    }
}