Can hitTestPoint be used with local coordinates at all?

Posted by mars on Stack Overflow See other posts from Stack Overflow or by mars
Published on 2010-03-12T18:22:59Z Indexed on 2010/03/12 18:27 UTC
Read the original article Hit count: 262

In AS3 I have a game where a vehicle rotates to the direction of the cursor, but when it "moves", its sprite stays stationary in the middle of the stage while the map layer below it actually moves, causing the illusion of movement of the vehicle on the map. There are obstacles on the map that the vehicle cannot pass. The obstacles are in a movie clip that is a part of the map layer and move with it.

hitTestPoint seems only to be able to check if the obstacle clip is touching points on the stage rather than points on the map, meaning that I cannot feed it the same coordinates I use to check the map boundaries, which are points on the map. I don't think I can use localToGlobal because the function I use to check obstacle collisions does not have access to a reference to the obstacle movie clip.

Is there a way in these conditions to force hitTestPoint to use its local coordinate system on the map?

I have included a diagram:

alt text

© Stack Overflow or respective owner

Related posts about as3-actionscript

Related posts about hittest