|
I need to make it so that when you hold down "Fire1" the player shoots continuously until you release. Is there a way to do that? Here's the script I'm using to shoot: The script works but all I need is to make shoot continuously when holding a button down. Please help.
(comments are locked)
|
|
Input.GetButton is what you're after. It's used the same as you have in your code above, but is activated for all frames the button is held down. Ok, but the problem is that too many our firing at a time. Now the lasers are colliding and go in random directions. How do I make so that shoot at a specified rate?
Aug 06 '11 at 12:13 AM
Overlord
That's a whole new problem. Search through the questions on this site (and on google) for creating a cooldown timer.
Aug 06 '11 at 12:27 AM
Chris D
Okay thanks
Aug 06 '11 at 05:37 AM
Overlord
(comments are locked)
|
|
you need to create a "fireSpeed" variable, so var fireSpeed = .5 will make them fire every half a second. then all you need is in your if statement, if(Input.GetButton("Fire1") && Time.time > firespeed) what that does is compares the current time passed to your firespeed. I believe that's what you're looking for. I'm not sure if you realized, but this was answered already, although that would have been an acceptable answer for one of my other questions (already answered). Anyway, thanks for trying though.
Oct 19 '11 at 02:02 AM
Overlord
(comments are locked)
|
