To kill the "bad guys" is another tradition of video-games. Here, if the character goes to the next door, the pointer changes to a sight. This is a signal: there are a "bad guy" trying to kill you! The player needs to click this "bad guy" soon or it will be dead! THIS DEMO HAS SOUND!
The sight is a movie-clip (it's name is: sight). This movie clip is in the frame 25 (the frame of the second map). The program glued to it changes the pointer:
onClipEvent(load){
mouse.hide();
startDrag(this,true);
}
The real action is a program glued to the "bad-guy". He is also a movie-clip:
onClipEvent(load){
dead = 0;
timer = 0;
}
onClipEvent(enterFrame){
if(dead == 1){
mouse.show();
stopDrag();
_root.sight._visible = false;
}
if(dead == 0{
timer = timer + 1;
if(tempo == 15){ //After 15 loops the character dies
_root.nextFrame(); //Has dead message
}
this.onMouseDown=function(){ //click in the bad guy
_root.shootsound.start();
this._visible = false;
dead = 1;
}
}
Easy and funny...
PREVIOUS LESSON T. CONTENTS HOMEPAGE