Problem with HitTest
- Floirt
-
Floirt
- Member since: Nov. 3, 2005
- Offline.
-
- Forum Stats
- Member
- Level 11
- Blank Slate
Hello,
I need some help.
I want to draw a maze, and a character would move in, without touching the walls or he "dies" (well, he just go to the "play level" frame)
But when i draw my maze, convert it to movieclip and stuff,
when I test, it goes back directly to the "play level" screen.
So, is there a way to draw the maze directly, or i have to use symbols and rotate/skew/etc. my walls?
Thanks,
Floirt
- FatalFuryX
-
FatalFuryX
- Member since: Jun. 29, 2006
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
if (Objects.hitTest(getBounds(_root).xMax, _y, true)) {
//game over
}else if (Objects.hitTest(getBounds(_root).xMin, _y, true)) {
//game over
}else if (Objects.hitTest(_x, getBounds(_root).yMax, true)) {
//game over
} else if (Objects.hitTest(_x, getBounds(_root).yMin, true)) {
//game over
}
Try that out
-Fatal
- Floirt
-
Floirt
- Member since: Nov. 3, 2005
- Offline.
-
- Forum Stats
- Member
- Level 11
- Blank Slate
Ummmm, i think i'm doing something wrong...
onClipEvent (enterFrame) {
if (this.hitTest (_root.level)(getBounds(_root).xMax, _y, true)) {
}else if (this.hitTest(getBounds(_root).xMin, _y, true)) {
}else if (this.hitTest(_x, getBounds(_root).yMax, true)) {
} else if (this.hitTest(_x, getBounds(_root).yMin, true)) {
}
}
Have i done something false here?
Thanks fatal through :)
- noob-toast
-
noob-toast
- Member since: May. 18, 2004
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
You could also use shapeFlag hitTesting, which isn't what the Flash MX example of the maze does, but it still gets the job done at times.
if(maze.hitTest(_x,_y,true)){
die
}
That's a shapeflag hitTest on the Registration Point of a movieclip.


