Hit detection for gaming

I am making a game and I want to make it so that if something get’s hit 3 times than it jumps to a new frame. This is a pong type game and so I want it so that there is a boss who gets hit three times then a movie clip with flowers comes out. If anyone has scripting that can help I will be really, really happy.
Roxy Gurl:)

Well… If this is a pong type game then my guess is you have a series of boxes and a ball… 2 paddles or one… if it’s a block hitting style…

So… You will hopefully find this piece of code to be very useful… :smiley:

[AS]

// Found in the block’s movieclip. the one you are copying

onClipEvent(load)
{
this.strength = 3; // How many times you hit it for it to progress
this.hitLevels = 2; // How many times you can knock it before deleting
this.holder = this.strength;
}

onClipEvent(enterFrame)
{
if(this.hitTest(_root.ball._x, _root.ball._y, TRUE))
{
this.holder–;
if(this.holder == 0)
{
this.holder = this.strength;
this.hitLevels–;
if(this.hitLevels == 0)
{
this.removeMovieClip();
}
else
{
this.gotoAndPlay(2);
}
}
}
}

[/AS]

Hopefully this works out for you… :smiley: