Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

object collisions

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
how can i make the screen flash when an object collides into another? I was thinking of using a variable 'a' and then a goto 'a' in a blank frame(used to simulate a flash). I don't know how to make variables global though and i am assuming that thats my problem.

 
the best way to do that would probably be with _hitTest.
It returns a Boolean indicating whether or not a movieClip intersects with a given point or another movieClip.
Then to get the screen to flash you should have a different movieClip with an animation for the effect.
So lets assume your two movieClips are mc01 and mc02. And the screen effect is called flash.
Your code would look something like this.

if(mc01.hitTest(mc02)){
flash.gotoAndPlay("on");
}

that should give you an idea of how it could work.

defkon2012

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top