Search Tutorials
HitTests, a.k.a Collision detection
So one day I was sittin around waiting for life to give me somethin to do, and I got this email... i need a code that would prevent me from goint trought the wall and i need
a hot spot, when sprite walk into it it will change to a new frame Despite the spelling and lack of information, I decided this person wanted to know about hittests, since it seemed a hittest would solve both problems (im not talking about the spelling and lack of information). To prevent you from going through a wall, you would need a hittest to see if you are hitting the wall. You would also need a hitTest to detemmine whether you are over a "hot spot" to activate some script that would change the frame. myMovieClip.hitTest(x, y, shapeFlag) Ok, there are obviously two variants of the hitTest, there is the hitTest that checks whether a point on screen "hits" the movie clip, and another to check whether a movie clip "hits" another movie clip. The point on the screen is good for stuff like figuring out whether the mouse is over something, and I'll show you how to use it to check you do not run into a wall.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||
|