Banner

Sponsor

Login


Welcome Back!
Guest
Guest

Register

Lost your password?

65 users online



hitTest area

hitTest area

Currently viewing this thread: 1 (0 members and 1 guests)


happypants

happypants

Neverside Newbie
Status: Offline!

hitTest area

I'm not too great with flash and I'm trying to make a simple game. I was looking at this tutorial: http://actionscript.org/tutorials/beginner/games_in_flash/index.shtml and I realized that the actionscript: if (box_mc.hitTest(ball_mc._x, ball_mc._y)) is saying that if anywhere in the box_mc's little square REGION thing touches the CENTER POINT of the ball, flash "calls it a hit". Is there anyway you could change the (ball_mc._x, ball_mc._y) part, instead of saying just the center point, to saying, for example, any point less than 30 pixels away from the ball's center point, or even just saying, if it hits the ball itself. What i'm trying to get at is this: hitTest works well when you're using a box and a little dot, but what about more complicated and/or larger shapes?

sorry for rambling so much...

action

action

Neverside Newbie
Status: Offline!

Unfortunatly Flash has never been too good at hit detection. There are ways round it using multiple hit points or the distance between objects using Math.SQRT for example, that works well for circles but more complex shapes i'd use multiple hit test in a for...loop.

Quick Jump:

Main Navigation


Site & Graphic Design by Aeon Tan
Developed by Jeremie Pelletier & Scott Roach


NeverAPI generated this page in 0.0158 seconds.