I have crated a split screen game in witch players shoot at each other a lose lives. The problem is that the player can just push fire rapidly to kill the player. Can you help me make a script that stop the player for continuously pressing the fire button? This is the script I have.
var speed = 3.0;
var rotateSpeed = 3.0;
var BulletPrefab:Transform;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
//Rotate around y - axis
transform.Rotate(0, Input.GetAxis ("Horizontal") * rotateSpeed, 0);
// Move forward / backward
var forward = transform.TransformDirection(Vector3.forward);
var curSpeed = speed * Input.GetAxis ("Vertical");
controller.SimpleMove(forward * curSpeed);
if(Input.GetButtonDown("Jump"))
{
var bullet = Instantiate(BulletPrefab, GameObject.Find("spawnPoint").transform.position, Quaternion.identity);
bullet.rigidbody.AddForce(transform.forward * 3000);
}
}
@script RequireComponent(CharacterController)