Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7759403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:37:11+00:00 2026-06-01T13:37:11+00:00

This is the collision if(blue2.hitTestObject(_helicopter)) { trace(YOU HIT THE BLOCK!); ihit = true; _helicopter.x

  • 0

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:37:12+00:00Added an answer on June 1, 2026 at 1:37 pm

    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:

    // needed imports:
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    
    if (blue2.hitTestObject(_helicopter))
    {
        trace("YOU HIT THE BLOCK!");
        ihit = true;
        _helicopter.x = 76;
        _helicopter.y = 217;
    
        var timer:Timer = new Timer(5000); // 5-seconds
        timer.addEventListener(TimerEvent.TIMER, function(event:TimerEvent):void
        {
            timer.reset();
            timer.removeEventListener(TimerEvent.TIMER, arguments.callee);
            trace("5-seconds after hitting the block.");
        });
        timer.start();
    }
    

    If you don’t like the anonymous function, you could implement it as:

    // needed imports:
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    
    if (blue2.hitTestObject(_helicopter))
    {
        trace("YOU HIT THE BLOCK!");
        ihit = true;
        _helicopter.x = 76;
        _helicopter.y = 217;
    
        var timer:Timer = new Timer(5000); // 5-seconds
        timer.addEventListener(TimerEvent.TIMER, collisionWaitHandler);
        timer.start();
    }
    
    // ... later in its own function:
    
    protected function collisionWaitHandler(event:TimerEvent):void
    {
        var timer:Timer = Timer(event.currentTarget);
        timer.reset();
        timer.removeEventListener(TimerEvent.TIMER, collisionWaitHandler);
    
        trace("5-seconds after hitting the block.");
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making this quick pong game and using hitTestObject to check for the collision.
Alright, so I have this collision detection code, and I'm trying to push the
The code I'm using in my collision detection code is this: (note: Vector3f is
I'm working on a demo about collision detection. (Some of the code for this
Been working on this problem of collision detection and there appears to be 3
I'm building a game in Javascript using canvas which requires collision detection, in this
Possible Duplicate: Circle-Rectangle collision detection (intersection) Collision detection between a line and a circle
Please, look at this GIF: Collision is detected properly, but those glitches annoy me...
I am currently using this code for 2D Collision Detection in my Space Invaders
I'm working on this method which deals with collision detection. I'm having an issue

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.