A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: [as2] Collision Detection

Threaded View

  1. #1
    Member
    Join Date
    Sep 2003
    Location
    Brazil
    Posts
    49

    [as2] Collision Detection

    Hi.
    I´d like to know how can I make a collision detection between two objects with complex shapes.

    Each object has a parent movieclip.

    Example:

    _root.obj1.child
    _root.obj2.child

    I need to make a collision detection test between each child of those two objects.

    As far as I know. I can use the hitTest for bitmap. But isn´t working.
    I´m not finding the right way to do it.
    I think it needs localToGlobal for x and y for each child clip coordinates and matrix, because obj1.child and obj2 rotates on _root.onEnterFrame.

    The function itself would be something like this:

    function checkCollision(a:MovieClip, b:MovieClip):Boolean{
    var boolean:Boolean = a.hitTest(b)
    return boolean
    }

    And the function call would be something like this:

    checkCollision(obj1.child, obj2.child)

    Anybody know how?

    Please, I can´t use GSkinner´s class.
    Ah, and that way of creating empty movie clips surrounding the shape´s edges takes too long for me because I have a lot of objects.

    Thanks
    Last edited by marcelozep; 07-22-2010 at 04:45 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center