I was wondering if I’ve done something wrong, or it’s simply Flash (I use 5). I can’t get the hit test (true) to work on a clip that animates (all it does is grow in size). If I set the hittest to false so it just reads the box of the clip, and not the shape it works just fine. The clip in question is simply a circle.

Well… remember that a hit test based upon the actual dimensions of an object cannot be used to detect if two movie clips colide.

not sure if you’re trying to do that… but it’s the only rule of thumb I know on hittests.

The dimensional hittest is used, I believe, to detect if a movie clip is on a particular x and y location, rather than on another movie clip. This can be useful if you’re trying to see if the mouse has colided with the movie clip, but possibly little else.

If you’re using circles or simple shapes, you’re better off scripting your how hitTest method. Based on distance and stuff. D’you what i mean?

pom :slight_smile:

Try this, pixel level hit test aren’t totally possible in flash, as quality settings of a movie, can put pixels out of line. You can do a simple hit test that tests the bounding boxes (the blue ones around your mcs) or an x y hit test. You can also do distance based hit tests.

Try this fla - I think it’s one of the most accurate ways of testing for a hit I’ve seen so far…

I use the hitTest frequently in my games and it is a pain to get an accurate hit test, but it can be done. There are always work arounds…

(plug) Some of the game flas on my site have good examples of hitTests in them(/plug)

Here’s a distance approximation based one:

I think the second one is better for a start. The first one looks very good though.

pom :asian:

The second one is a simple da hit test, whereas the first one is as close to pixel based hit test as you’ll get. The second one is obviously useful for circle’s but the first can be used for irregular shapes.

i’ve always thought that hittest is true only when one shape passes over another…but does it actualy create “box” around the shape and anything in that area has a true hittest?

Yep. That’s why you can’t really use that method. There was a very good article somewhere about that, let me look for it.

pom :asian:

Well… you can use it Pom. :), it works quite well in any situation where the object is small, and uniform. In most gaming situations the regular hit test is very useful.

And where was my brain. Oh yeah, I forgot. Thanks for the Radius tip Flex. Back into it now…

radius is a pretty good idea actualy…though it would only work on a circle thats totaly uniform…I’ve used hit test for a couple of games…its not really that bad… it would be beter if it only picked it up when pne shape overlaps another… oh well :slight_smile: