I am making a side scrolling shooter and I want the game to be a challenge. I find that holding down the shoot button makes the game a lot easier, is it possible to force the player to have to press the key repeatedly so they cant just hold it down?
You can use GetButtonDown instead of GetButton to check the input, that will only be true on the same frame they pressed the button.
Maybe have a bool called CanShoot, on key down it shoots, and canShoot is then false, on key up CanShoot is reset to true? Obviously in your shoot method have an if (canshoot == true)
Just an idea ![]()
Perfect, many thanks
I’ve only been using Unity for a little over a week so I still have many of the basics to learn.
That bool idea will work for single shot, if you want a timer you can always do a Time.deltaTime and set the bool to false if it’s say longer than 1 second of holding
You can do this too, I use it in my games often.
You can instantiate this from an update
public float fireDelay = 0; // with this you delay first shoot, you can keep this at 0 in your case
public float fireRate; // this delays next bullet, so let’s say every one second it will fire another bullet
if(Time.time > fireDelay){
fireDelay = Time.time + fireRate;
//here you instantiate your gameobject, like bullet
}