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

  • SEARCH
  • Home
  • 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 932635
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:42:06+00:00 2026-05-15T20:42:06+00:00

I know that there are people out there creating classes for this (ie http://coreyoneil.com/portfolio/index.php?project=5

  • 0

I know that there are people out there creating classes for this (ie http://coreyoneil.com/portfolio/index.php?project=5). But I want to learn how to do it myself so I can create everything I need the way I need.

I’ve read about BitMap and BitMapData. I should be able to .draw the MovieClips onto a BitMap so I could then cycle the pixels looking for the collisions. However, It’s weird and confusing dealing with the offsets.. And it seams like the MyBitMap.rect has always x = 0 and y = 0… and I can’t seam to find the original position of the things…

I’m thinking of doing a hitTestObject first, then if this was positive, I would investigate the intersection betwen the movieclips rectangles for the pixel collisions.
But then there is also another problem (the rotation of movieclips)…

…I need some enlightment here on how to do it.
Please, any help would be appreciated..

  • 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-05-15T20:42:06+00:00Added an answer on May 15, 2026 at 8:42 pm

    I managed to do it after all, and I already wrote my class for collision detections,/collisions angle and other extras.

    The most confusing process is maybe to align the bitmaps correctly for comparing. When whe draw() a movieclip into a a BitmapData, if we addChild() the corresponding Bitmap we can see that part of it is not visible. it appears to be drawn from the center to right and down only, leaving the top and left parts away from beeing drawn. The solution is giving a transform matrix in the second argument of the draw method that aligns the bitmap and makes it all be drawn.

    this is an example of a function in my class to create a bitmap for comparing:

        static public function createAlignedBitmap(mc: MovieClip, mc_rect: Rectangle): BitmapData{
                    var mc_offset: Matrix;
                    var mc_bmd: BitmapData;
    
                    mc_offset = mc.transform.matrix;
                    mc_offset.tx = mc.x - mc_rect.x;
                    mc_offset.ty = mc.y - mc_rect.y;
                    mc_bmd = new BitmapData(mc_rect.width, mc_rect.height, true, 0);
                    mc_bmd.draw(mc, mc_offset);
    
                    return mc_bmd;
    }
    

    in order to use it, if you are on the timeline, you do:

    className.createAlignedBitmap(myMovieClip, myMovieClip.getBounds(this))
    

    Notice the use of getBounds which return the rectangle in which the movie clip is embedded. This allows the calculation of the offset matrix.

    This method is quite similar to the on shown here http://www.mikechambers.com/blog/2009/06/24/using-bitmapdata-hittest-for-collision-detection/

    By the ways, if this is an interesting matter for you, check my other question which I’ll post in a few moments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know that there are lots of examples out there on this, but they
I know that there are some threads have a similar issue with this thread.
I know that there are lot's of questons on this, but all seem to
I know there were plenty of questions like this but I am creating the
I hope this is a simple enough question for any SQL people out there...
If there are any language designers out there (or people simply in the know),
I know that there are others posts with solutions on the site but i
I know that there are currently questions on SO already pertaining to saving jQuery
I know that there can be multiple values for an email, but I'm not
I know that there are many Delphi database related questions available, but I'm considering

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.