# Help with hitTest

**URL:** <https://forum.kirupa.com/t/help-with-hittest/24387>\
**Category:** flash\
**Created:** [June 30, 2003, 8:23am UTC](https://forum.kirupa.com/t/help-with-hittest/24387 "2003-06-30T08:23:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Zidane\_ffs](https://avatars.discourse-cdn.com/v4/letter/z/e56c9b/32.png) [@Zidane\_ffs](https://forum.kirupa.com/u/Zidane_ffs)\
**Post date:** [June 30, 2003, 8:23am UTC](https://forum.kirupa.com/t/help-with-hittest/24387/1 "2003-06-30T08:23:24Z")

</div>

Hey ppl

I’m trying to create a game (soughta like Zelda, ya walk around and kill things) but I’m having some trouble with hitTest

When my character walks to a certain movieclip (a movie clip titled ‘area’) its supposed to go to the next frame, but its not. Can anyone help me with the scripting for this?

Cheers

---

<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:** [June 30, 2003, 10:30am UTC](https://forum.kirupa.com/t/help-with-hittest/24387/2 "2003-06-30T10:30:29Z")

</div>

You can draw your level on one layer. Put your character on this level also, in a movie clip.

Then on a seperate layer, draw lines where you want your character to stop, a sort of outline of the level. Make this a movieclip also

Then you do a hitest whenever the character movieclip moves, and the object to test is the outline movieclip.

I have seen this done somewhere…Ill try and remember where…

Regards,

Dravos

---

<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:** [June 30, 2003, 10:39am UTC](https://forum.kirupa.com/t/help-with-hittest/24387/3 "2003-06-30T10:39:58Z")

</div>

Heres the link, its an open source zelda thing, but the code looks like what you want…

[http://www.marmotte.levillage.org/\_html/\_flash\_games/zelda\_open.html](http://www.marmotte.levillage.org/_html/_flash_games/zelda_open.html)

---

<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:** [June 30, 2003, 12:57pm UTC](https://forum.kirupa.com/t/help-with-hittest/24387/4 "2003-06-30T12:57:15Z")

</div>

Cool, thanx for the help

---

<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:** [June 30, 2003, 2:10pm UTC](https://forum.kirupa.com/t/help-with-hittest/24387/5 "2003-06-30T14:10:08Z")

</div>

I’ve been messing around with it but I cant seem to get what I need  
Not only did I need a way to set boundry’s but I need a way in which by hitting a certain coordinate or movieclip the movie goes to the next frame

Any ideas?

Cheers

---

<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:** [June 30, 2003, 2:52pm UTC](https://forum.kirupa.com/t/help-with-hittest/24387/6 "2003-06-30T14:52:33Z")

</div>

Righty o

i’m having some problems with my game im making. So far In it I have a character, that can be moved by the keys, and a desk, which the character is supposed to walk to and pick up the guns on it.

Now my problem is I have a moveclip (an invisible black square) on one layer and the character on another layer. I’ve used the hitTest function telling it that when the character hits the black square to go to the next frame but, of course, the bloody movie does stuff all

any help with understanding how to use the hitTest properly would be great

Cheers

PS. If ya want the .fla to see what the hell im talking bout i’ll be happy to send it

---

<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:** [June 30, 2003, 3:18pm UTC](https://forum.kirupa.com/t/help-with-hittest/24387/7 "2003-06-30T15:18:39Z")

</div>

[http://www.kirupa.com/developer/actionscript/hittest.htm](http://www.kirupa.com/developer/actionscript/hittest.htm)

there is a hitTest tutorial. If you need more help once you are finished with that, then post. 🙂

---

<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:** [June 30, 2003, 10:28pm UTC](https://forum.kirupa.com/t/help-with-hittest/24387/8 "2003-06-30T22:28:20Z")

</div>

Yeah I’ve seen that tutorial already but I still can’t get the \*\*\*\* thing to work

Sorry bout the trouble, Im a newbie to actionscript

Cheers

---

<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:** [July 1, 2003, 7:25pm UTC](https://forum.kirupa.com/t/help-with-hittest/24387/9 "2003-07-01T19:25:01Z")

</div>

im not shore if this is to late but ill give it a go anyway here is some very basic hitTest

onClipEvent (enterFrame) {  
if (this.hitTest(\_root.object)) {  
\_root.gotoAndStop(3);  
}  
}
