View Full Version : [AS2] shooting lazer
scottywatty_flash_man
04-29-2009, 01:03 AM
I want to add a weapon to my game, where this guy is moved with the up/down/left/right keys.
What I want is when ever you push the space bar, the guy yells "ANILIATION!!!!!" and then a SUPER DUPPER LAZER shoots out of his mouth. :) This lazer should cover the whole screen lenght wise, and only last 5 seconds or so, No matter how long you hold the space bar. Basicly, i want the space bar to activate the lazer, not control it. Also, the animation for the lazer should only start once the sound "ANILIATION!!!!" has finished...
Any ideas?
ImOnCloudNine69
04-29-2009, 01:30 AM
freeactionscript.com
i was gonna type it out, but i got my way of doing things from there anyway, navigate to weapons.
pierre23
04-29-2009, 04:18 AM
If its just an animation thats going to play when space bar is clicked add a listener function to the space bar (the keyCode is 32) to start the animation playing within a movieclip.. and also add to the code, when space is pressed, to remove the listener, so it's only possible to press it once.
Check out the following link for the Key Class;
http://flash-creations.com/notes/asclass_key.php
ImOnCloudNine69
04-29-2009, 04:32 AM
If its just an animation thats going to play when space bar is clicked add a listener function to the space bar (the keyCode is 32) to start the animation playing within a movieclip.. and also add to the code, when space is pressed, to remove the listener, so it's only possible to press it once.
Check out the following link for the Key Class;
http://flash-creations.com/notes/asclass_key.php
you would think he only wants it pressable like only so often, more like a reload time. which that link i provided gives a very efficient way to do that as well.
pierre23
04-29-2009, 04:36 AM
Sure, easily done with a timer function to enable to listener again :)
I havn't seen the website link, but just giving an alternative if he can't find what he's looking for.
ImOnCloudNine69
04-29-2009, 05:29 AM
Sure, easily done with a timer function to enable to listener again :)
I havn't seen the website link, but just giving an alternative if he can't find what he's looking for.
exactly, its all done with setInterval
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.