Hit Test problem

Pom tried this and couldn’t get it working, I wanna get some more opinions:\r\rI’ll try to explain it as best I can. I have a movie clip of a long bar shape that spins. I programed it to move up down left and right when the correct arrow keys are pressed. \r\rThen I have anohter movie clip that dosent move. I tried to use Hit test to make it tell me when the two touch. The problem is that it works too good. It says its touching when the bar gets close and when it really is covering. \r\rOK, i know this is really confusing, thats why I uploaded the FLA for any one who wants to help. \r\rhttp://www.angelfire.com/pokemon2/onlinepics/spin.html

I tried to do it, and it’s a real pain in the ass. Moreover, there’s no Shape flag when you do it like this, so I think the best solution is to create your own hitTest function. Easy. :smiley: \r\rpom 0]

I can’t get it to work. Pisses me off.\r\rpom 0]

Closest I could get :in the first frame

 MovieClip.prototype.hitTest2 = function (largeur) {\r\r&nbsp &nbsp &nbsp &nbsp var distx = _root.circle._x - this._x ;\r\r&nbsp &nbsp &nbsp &nbsp var disty = _root.circle._y - this._y ;\r\r\r\r&nbsp &nbsp &nbsp &nbsp var distance = Math.sqrt(distx*distx+disty*disty);\r\r\r\r&nbsp &nbsp &nbsp &nbsp var angle = Math.atan2(disty,distx) ; //angle in radians\r\r&nbsp &nbsp &nbsp &nbsp angle *= 180/Math.PI ; //angle in degrees\r\r\r\r&nbsp &nbsp &nbsp &nbsp trace (distance - _root.circle._width/2 > largeur) ;\r\r&nbsp &nbsp &nbsp &nbsp if (distance - _root.circle._width/2 > largeur) {\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.texte = "No collision";\r\r&nbsp &nbsp &nbsp &nbsp } else {\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp a = this._rotation>angle-_root.circle._width/distance*180/Math.PI ;\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp b = this._rotation<angle+_root.circle._width/largeur*180/Math.PI ;\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp c = this._rotation-180<angle+_root.circle._width/largeur*180/Math.PI ;\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp d = this._rotation+180>angle-_root.circle._width/largeur*180/Math.PI\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp if (a and b and c and d){\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.texte = "Collision" ;\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp else {\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp _root.texte = "No collision";\r\r&nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp }\r\r&nbsp &nbsp &nbsp &nbsp }\r\r}

on the Line movie clip (has to be FLAT !!)

 onClipEvent (load) {\r\r&nbsp &nbsp &nbsp &nbsp // the line has to be flat !!\r\r&nbsp &nbsp &nbsp &nbsp large = this._width;\r\r}\r\r\r\ronClipEvent (enterFrame) {\r\r&nbsp &nbsp &nbsp &nbsp _rotation+=1 ;\r\r&nbsp &nbsp &nbsp &nbsp this.hitTest2(large);\r\r}

This code slows my computer, so you better have a good computer.\r\rpom 0]

Maybe this will help.\r\rmedia.nintendo.com/ninten…_mov01.wmv\r\rthat link is to a movie file of a GBA video game that im trying to clone\r\rheres a link to it’s main page\r\r[url=“http://nintendo.com/games/gamepage/gamepage_main.jsp?gameId=1279&showMe=1”]nintendo.com/games/gamepa…9&showMe=1

didnt work for me using either. (I just tried for grins)

Here are links to 2 other flash forums that are working on it, se if what they’ve done helps at all\r\rwww.were-here.com/forums/…post896780\r\r[url=“http://flashmove.com/board/showthread.php?s=cd8ff3ced13f2a85e88376501e7749f5&threadid=7276”]flashmove.com/board/showt…eadid=7276

ok, the link i posted above dosent work so try this\rwww.angelfire.com/pokemon…/spin.html\r\rand pom, try this,\r\r[url=“http://www.angelfire.com/pokemon2/onlinepics/spin2.html”]www.angelfire.com/pokemon…spin2.html\r^ goto this page ^\rtry to make it so the hit tests works between the bar and the circle, not the black box (you’ll see what I mean if you goto that second link and d/l it)