Flashadvisor logo
:: Desktop Shortcut
:: Flash Help
Advices from Experts

 Submit Here! · Link to Us · Newsletter · Tell a Friend ·

      Add Tutorial |

 

Advertise here

Create Speaking Characters for your website and Flash movies. 15 Day Free Trial




PHP Scripts

 

 Home > Tutorials  > Beginners

How to make a shooting face game

Author: Bryce | Email
Website : www.freewebs.com/ahalostory


Advertisement

Now we have to go and make the crosshair. You draw a crosshair and convert it to a symbol of type movieClip. Select it and type this into its code box:


Code:

onClipEvent (load)

{

startDrag(this, true);

Mouse.hide();

this.swapDepths(9999);

}



onClipEvent(mouseDown)

{

playsounds = new Sound(this);

playsounds.attachSound("shot");

playsounds.start(0, 1);

for(i=1;i<=5;i++)

{

if(this.hitTest(_root["face"+i])&&_root["face"+i].dead==0)

{

_root["face"+i].gotoAndPlay(2);

}

}

}




When this loads it will follow the mouse cursor because we set the startdrag of "this" to true. Mouse.hide just hides the original mouse cursor so our crosshair is our cursor. We want to make the depths of this 9999 so it will appear on top of all the faces(otherwise if you hover over a face, the crosshair vanishes behind the face). Now the onClipEvent(mouseDown) is what happens when we click the mouse. The playsounds lines tells it to play a shot sound I imported in for the movie. To use a sound like this, you have to open the movie's library and find the sound you imported, right click-->linkage and check "export for actionscript". playsounds.start(0,1) tells the sound to loop once(play once). The next part says that if when we click the crosshair is touching one of the duplicate faces(the reason for the loop being from 1 to 5) and if the face is still alive, we want that face to go to its 2nd frame and start its death sequence. This will end when the face reaches its last frame and resets.


Ok, thats it for a basic shooting game!

| 1 | 2 | 3 |

Rate This Tutorial :
We hope the information helped you. If you have any questions or comments, please don't hesitate to post them on the Forums section
Submit your Tutorial at Click Here
  

Home | About Us | Contact Us | Feedback | Advertise with us

Best viewed in 800x600 resolution with Internet Explorer.

Site Developed and Hosted by  ethicsolutions.com
All rights reserved with FlashAdvisor

Flash is a registered trademark of Adobe Systems, Inc.

11 users online