# hitTest not working for plane collision

**URL:** <https://forum.kirupa.com/t/hittest-not-working-for-plane-collision/17367>\
**Category:** flash\
**Created:** [April 4, 2003, 6:39am UTC](https://forum.kirupa.com/t/hittest-not-working-for-plane-collision/17367 "2003-04-04T06:39:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ironikart](https://avatars.discourse-cdn.com/v4/letter/i/7feea3/32.png) [@ironikart](https://forum.kirupa.com/u/ironikart)\
**Post date:** [April 4, 2003, 6:39am UTC](https://forum.kirupa.com/t/hittest-not-working-for-plane-collision/17367/1 "2003-04-04T06:39:29Z")

</div>

I can’t seem to get hitTest to work for the plane in my little game. The code I’m using in the plane MC is:  
[AS]if (\_root.player.hitTest("\_root.badguy"))  
playerhealth -= 20;  
}  
if (playerhealth\<1) {  
\_root.gotoAndPlay(“gameover”,1);  
}  
{[/AS]

I want to the badguy plane to hit the player’s plane and take a subtraction from the player’s heath. I’ve fiddled around with using “this” instead of the full path of the playerMC - no success. My hitTest is working fine for the bullets!

I’ve attached the fla if you want to have a look at it. It might make more sense than my rather rushed explanation.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 4, 2003, 6:49am UTC](https://forum.kirupa.com/t/hittest-not-working-for-plane-collision/17367/2 "2003-04-04T06:49:08Z")

</div>

Your hitTest works fine. I used a trace to test it. Try this…

[AS]if (\_root.player.hitTest("\_root.badguy")) {  
trace(“hit”)  
playerhealth -= 20;  
}  
if (playerhealth\<1) {  
trace(“done”)  
\_root.gotoAndPlay(“gameover”,1);  
}[/AS]

You have it gotoAndPlay that goes to a new scene.

What sucks about scenes is that they suck. Haha, sad but true. To get your scene targetting to actually work right give frame 1 in the scene gameover a frame label. Lets say “gameOver” (no quotes). Then target it with \_root.gotoAndPlay(“gameOver”) (use quotes this time)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 4, 2003, 7:07am UTC](https://forum.kirupa.com/t/hittest-not-working-for-plane-collision/17367/3 "2003-04-04T07:07:51Z")

</div>

Thanks for that. I thought theoritically that a new scene should play just the same as the current one. Ah well, it works fine now. Thanks again for your expertise and fast response!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [April 4, 2003, 7:17am UTC](https://forum.kirupa.com/t/hittest-not-working-for-plane-collision/17367/4 "2003-04-04T07:17:21Z")

</div>

Yeah, TECHNICALLY it shoulda worked, but Flashs support for it’s own Scenes system sucks big time, it’s so buggy it is unbelievably annoying. Mainly playing them is a pain, but as long as you always use frame labels and gotoAndPlay them, it should work, that is the best workaround to playing multiple scenes.
