How do I detect collision detection in flash AS3?

Avtar Brar picture Avtar Brar · Apr 18, 2013 · Viewed 27.6k times · Source

I wanted to create a maze in flash AS3, with the user guiding the character. I tried using this (below) but this will require me to make all the maze walls individual and setting collision detection to each one. Is there an easier way of accomplishing the same thing?

monkey.addEventListener( Event.ENTER_FRAME, handleCollision)

function handleCollision( e:Event ):void
{
    if(monkey.hitTestObject(wall))
       {
           trace("HIT");
       }
       else
       {
           trace("MISS");
       }
}

Answer

RafH picture RafH · Apr 18, 2013

You can use the Collision Detection Kit : https://code.google.com/p/collisiondetectionkit/