Question by
zak666 · Feb 01, 2016 at 01:34 PM ·
scripting problem
trying to get this loop to work. C# error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement
trying to get this loop to work for fire rate, using UnityEngine; using System.Collections;
public class PlayerFighter : MonoBehaviour {
public GameObject MachGunBullets;
public GameObject Missiles;
public int MissilesAmmount = 3;
public int Armor = 5;
public int Lives = 3;
public int PowerLevel = 1;
public float waittillnextfire = 0;
public float firespeed = 2;
//-----------------------------------------------------------------------------------------------------------------------
void Update () {
//player Controlls
if (Input.GetButton("z"))
if (waittillnextfire == 0) {
Instantiate (MachGunBullets, transform.position, transform.rotation);
waittillnextfire == 1;
}
waittillnextfire -= Time.deltaTime * firespeed;
}
}
Comment
Your answer
