Flash Game Actionscript hitTest/Collision detection problem!?

Callan

New member
I'm a flash programmer. usually I work with RPG type flash game programming, which includes no use of the hitTest. My problem is whenever I try to use hitTest, the game does not hitTest accurately. Instead of it reacting to details around the object, when the object collides with another it is treated as a square. This is particularly problematic, because my latest project (which I can't reveal much of ;) ) involves a gun, that is rotated. using arrow keys. There is an invisible line at the tip of the gun which acts as the detector of fire for the hitTest.

what REALLY annoys me is how when the gun is rotated, even if the line isn't anywhere near the line of fire, a collision is detected.

the code I'm currently using is:

if (_root.player.gun.fireline.hitTest(_root.enemy) {
_root.health -= damage;
}


I REALLY need help with this. Anyone who resolves this problem for me will be rewarded with a placement under "special thanks" on my game.


thank you.
-Callan
sorry, I made a mistake in the code, it's


if (_root.player.gun.fireline.hitTest(_root.enemy)) {
_root.health -= damage;
}
 
Back
Top