- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
LucasIAlmighty · Nov 14, 2012 at 03:39 AM ·
if statement
Why do I get this error:Expressions in a statement must be only executed by their side effects?
var prefabBullet:Transform;
var shootForce:float;
private var ammo:float;
private var shoot:float;
function Start () {
ammo = 5;
shoot = 1;
}
function Update ()
{
if (ammo == 0)
{
(shoot == 0);
}
if (shoot == 1 && (Input.GetMouseButtonDown(2)))
{
var instanceBullet = Instantiate(prefabBullet, transform.position, Quaternion.identity);
instanceBullet.rigidbody.AddForce(transform.forward * shootForce);
ammo -=1;
}
}
function OnGUI () {
GUI.Label (Rect (10, 10, 100, 20),ammo.ToString());
}
Its at this part if (ammo == 0) { (shoot == 0);
}
Comment
Your answer
Follow this Question
Related Questions
How to declare an objects x rotation 0 Answers
if occurs for continuesly for 3 seconds 1 Answer
How to make a ladder script 1 Answer
Melee attack comblat 1 Answer