x


bce0034 -_-

heres my script

var health = 60;
var something : GameObject;

function OnTriggerEnter(thing: Collider){
    if (thing.name == "Bullet"){
    health - 1;
    }
    else
    if (thing.name == "FlameBall"){
    health - 3;
    }
    else
    if (thing.name == "Bomb"){
    health - 6;
    }
    }

    function Update () {
    if (health <= 0)
    Destroy (something);
    }
i have 3 bce0034 errors, one at the first minus, one at the second and one at the semicolon after the 3rd minus

help plz

more ▼

asked Oct 16 '11 at 12:37 PM

sam32x gravatar image

sam32x
178 37 55 62

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

Instead of going

health - 1;

which is an assignment call, but with nothing to assign to, use

health -= 1;

Which modifies health directly. This is a shorthand for

health = health - 1;

which is the way you would usually modify an object in terms of itself.

more ▼

answered Oct 16 '11 at 12:42 PM

syclamoth gravatar image

syclamoth
14.8k 7 15 80

oh ok thanks

Oct 17 '11 at 04:51 AM sam32x
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x57

asked: Oct 16 '11 at 12:37 PM

Seen: 543 times

Last Updated: Oct 17 '11 at 04:51 AM