This is the collision
if(blue2.hitTestObject(_helicopter))
{
trace("YOU HIT THE BLOCK!");
ihit = true;
_helicopter.x = 76;
_helicopter.y = 217;
}
Is it possible to add the pause function in that collision code^? Is so, what do I write there please? Thank you!
Pause is a bit difficult to interpret in your context.
For instance, if your game had an enter frame handler you could stop all game animation for a period of time. Or, maybe you want to freeze a “You hit the block!” message for a period of time while background animations still ran.
One approach is to use a timer. It’s asynchronous, but the end result here is that a function is called after a period of time (milliseconds).
In this example, 5-seconds after your code is executed, an anonymous function responds that the time is up:
If you don’t like the anonymous function, you could implement it as: