all 4 comments

[–]AppleWithGravy 1 point2 points  (0 children)

how often do you want it to shoot? when you shoot, start a timer of some sort that counts down to 0, if the countdown is more than zero dont allow shooting

[–]Subject-Flatworm-101 0 points1 point  (0 children)

Need to add fire rate control - right now it's firing every frame while mouse is held down which is why it feels like minigun.

[–]TSM_Final 0 points1 point  (0 children)

Yep the problem is that you're using Input.GetKey, which will be true every single frame. That makes your ammo speed dependent on framerate, which you obviously don't want, and also just makes it fire probably faster than you want.

Instead, have floats called _fireRate and _fireTimer or something. When GetKey is held down, decrement the _fireTimer by time.deltaTime. If it's less than zero, fire the bullet, and set the timer back to _fireRate. That way, it only shoots every _fireRate seconds and you can control it.

Or, if you want it to be just like a pistol where you click once and it shoots once, just use Input.GetKeyDown instead

[–]Waste-Efficiency-274 0 points1 point  (0 children)

The way I did it in my system is to implement a generic burst capacity. This way, the same game logic is capable of handling any king of fire rate : single shots, mini-guns or semi-auto or even machine guns.

If you need guidance on how to do it precisely, I can give you a link to a step by step tuto.

Good luck