Hey, I have a problem. check out the .fla. I want the crosshair to make a sound when it shoots (on press). can somebody tell me how to do it or fix it up? the problem is that I can either make the sound happen or have the window break, but not both at once…please help!
In your library, select usp1, goto “Linkage” and choose “export for first frame”, then give it an idname (I used “klik”)
Then select your crosshair mc (“follow”) and put this AS on it:
[AS]onClipEvent (load) {
mySound=new Sound;
mySound.attachSound(“klik”);
}
onClipEvent (mouseDown) {
mySound.start();
}[/AS]
now you have both sounds;)
I ran into a little trouble again. Can anybody tell me how I can make a tracking device for Hit Points in a game? For example: you start off with 100 hp and on a certain event (press a button or whatever) you lose 20 hp and are left with 80 hp. Then, when you have 0 or less HP you are taken to a certain frame which displays the test “game over”. thx in advance.
PS I saw a tutorial for this on a site but I lost the link.
one more question. check out the shooting.fla. how can I prevent the mouse from firing and breaking the window when there are no bullets left? thanks in advance. :thumb:
Skip the code on the “glassbutton”.
Give your glassmc (“window2_movie”) an instancename “mc_glass”, then change your “gun.onMouseDown” code in:
[AS]gun.onMouseDown = function() {
if (ammunition.ammo) {
this.play();
shot.start();
ammunition.nextFrame();
if (sights.hitTest(mc_glass)) {
mc_glass.gotoAndPlay(2);
}
} else {
empty.start();
}
};[/AS]
when I followed your instructions, I could click on the glass and it would break then I could click on it again and it would break again but I want it to break once and remain broken. I probably followed your instructions incorrectly. I’ll try again in a few days but for now its the holidays and im taking a break. Merry Christmas & thx for the help. I have to go and enjoy my presents now…MP3 player.