PDA

View Full Version : laser game


heybigdonkey
03-21-2001, 07:53 PM
if i were making a game where i used something with the instance name "laser" to shoot something with the instance name "bg" and i wanted it to take three hits from the laser to remove the movieclip of the BadGuy what would the code look like.

Heybigdonkey

Strok
03-21-2001, 09:01 PM
You can use
removeMovieClip ("BadGuy");
on Collision Detection

There's a tutorial on Collision Detection


http://www.actionscripts.org/tutorials/intermediate/Collision_Detection/index.shtml

Jesse
03-22-2001, 01:00 AM
That tutorial's Flash 4 based. In Flash 5 we have the .hitTest element.

so something like this

if ( _root.a.hitTest(b) ) {
hits = hits ++;
}

if ( hits >= 3 ) {
// remove movie clip code here
}

a.hitTest(b);
checks if clips 'a' and 'b' are touching.

Cheers

Jesse