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. \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        var distx = _root.circle._x - this._x ;\r\r        var disty = _root.circle._y - this._y ;\r\r\r\r        var distance = Math.sqrt(distx*distx+disty*disty);\r\r\r\r        var angle = Math.atan2(disty,distx) ; //angle in radians\r\r        angle *= 180/Math.PI ; //angle in degrees\r\r\r\r        trace (distance - _root.circle._width/2 > largeur) ;\r\r        if (distance - _root.circle._width/2 > largeur) {\r\r                _root.texte = "No collision";\r\r        } else {\r\r                a = this._rotation>angle-_root.circle._width/distance*180/Math.PI ;\r\r                b = this._rotation<angle+_root.circle._width/largeur*180/Math.PI ;\r\r                c = this._rotation-180<angle+_root.circle._width/largeur*180/Math.PI ;\r\r                d = this._rotation+180>angle-_root.circle._width/largeur*180/Math.PI\r\r                if (a and b and c and d){\r\r                                _root.texte = "Collision" ;\r\r                }\r\r                else {\r\r                        _root.texte = "No collision";\r\r                }\r\r        }\r\r}
on the Line movie clip (has to be FLAT !!)
onClipEvent (load) {\r\r        // the line has to be flat !!\r\r        large = this._width;\r\r}\r\r\r\ronClipEvent (enterFrame) {\r\r        _rotation+=1 ;\r\r        this.hitTest2(large);\r\r}
This code slows my computer, so you better have a good computer.\r\rpom 0]
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)