Restart movieclip after hittest
Hi all
I have recently started to learn about flash and as2 and I am working on a small shooting style game.
I have managed to create a hero that moves around the screen and enemies which I shoot at.
The issue I am currently having is that on my ball movieclip (bullett) the first frame holds a ball
and the 2nd frame is a small animation of the ball breaking apart. So basically when the ball is thrown
and the hittest comes back true the 2nd frame plays showing ball breaking apart. Now when I fire a 2nd time
it constatly plays the 2nd frame of the broken ball. How can I resart the ball movieclip in its 1st frame to carry
on shooting normally. Below is the as2 I have on my ball movie clip.
onClipEvent (load) {
var statee;
statee = "ready";
maxJump = -30;
grav = 0;
gravity = 1.5;
rotate = true;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE)) {
statee = "position";
}
if (statee == "position") {
this._x = _root.hero._x;
this._y = _root.hero._y;
statee = "fire";
grav = maxJump;
}
if (statee == "fire") {
grav += gravity;
this._y += grav;
this._x += 10;
}
if (this.hitTest(_root.enemy)) {
this.gotoAndStop(2);
rotate = false;
this._rotation = 0;
}
if (rotate) {
this._rotation += 10;
}
}
Many thanks for all help and advice.
Rock