PDA

View Full Version : game hittest problem


marco66
10-21-2002, 08:55 AM
hi, I attach my game fla to make you better understand my problem.

I've to catch the butterflies using the little net catcher, but, if I use hittest, I can catch it only if the bounding box of the inside hidden box (the green rectangle) hits the flying bflies.

What I want to happen is that, as the bfly enters the green hidden area (and in any moments it is inside the green area),
collision is registered (and score increases together with numbers coming out).

Can you please help me?

farafiro
10-21-2002, 10:14 AM
a very cool graphics marco
u can make a shape exactly like the net and also make it shape tween like in its MC and use the hit test with it, sot with a solid rectangle

marco66
10-21-2002, 10:58 AM
thx farafiro for your prompt reply, but I think some words are missing, could you please post it again?

you mean that if I do an hitTest action to a clip doing a shape movement I get what I need?

and which hittest is better for this use?

_root.ugo.hitTest(_root.pino)

or

_root.ugo.hiTest(_root.pino._x, _root.pino._x, true)

farafiro
10-21-2002, 11:08 AM
yes, I mean that exactly, u can make a shape just exaclty like the net and tween it like it does, convert itto a mc and do your script.

the hitTest ways u mentioned just vary that the second one is very accurate, mostly used with the advanced level puaales game.
it just makes sure that the code works only if the both object in the same _x and _y

so, here in your case i think the first is the one

pom
10-21-2002, 11:11 AM
I believe the second one might work better (it doesn't take into consideration the bounding box, but it's not accurate with the butterfly...).

pom :cool:

farafiro
10-21-2002, 11:14 AM
hey POM
I think u reversed the codes, u mean the first one or what??

marco66
10-21-2002, 12:50 PM
hi farafiro,
I tried your method (you can see the attach fla...)
but the hittest still works only with the bounding box and the bfly
crosses the net too many times.

can you please have a look at my last fla to see if I did it well?

marco66
10-21-2002, 03:11 PM
sorry if I insist, farafiro,
do you have any good news for my game fla???:(