x


help with script

A little bit about how ill use it. my enemy car will be the target and if it gets hit 3-4 times by my player car, it'll die.

the error i get is:

(5,52): BCE0044: expecting }, found ''.
(5,52): BCE0044: expecting }, found ''.


public var explosionPrefab : Transform;

function OnCollisionEnter(collidedObject : Collision) {
    if (collidedObject.gameObject.tag == "Finish") {
       Destroy(collidedObject.gameObject);
more ▼

asked Jun 01 '11 at 07:23 PM

smasgames gravatar image

smasgames
34 25 29 32

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

2 answers: sort voted first

Your forgetting 2 end Brackets } in your code

more ▼

answered Jun 01 '11 at 07:28 PM

StarrockGames gravatar image

StarrockGames
1 2 2 3

thanks mate

Jun 01 '11 at 09:11 PM smasgames
(comments are locked)
10|3000 characters needed characters left
public var explosionPrefab : Transform;

function OnCollisionEnter(collidedObject : Collision) { 
if (collidedObject.gameObject.tag == "Finish") { 
Destroy(collidedObject.gameObject); 
}
}

You needed to add two end-brackets. When you have one start-bracket you need one end-bracket

more ▼

answered Jun 01 '11 at 07:29 PM

OrangeLightning gravatar image

OrangeLightning
5.3k 47 57 111

how do i change the script so when it collisions with or is collided with PlayerCar its gets destroyed?

Jun 01 '11 at 08:01 PM smasgames

Use the Destroy() function.

Jun 01 '11 at 08:24 PM OrangeLightning

thanks mate

Jun 01 '11 at 09:11 PM smasgames
(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:

x415
x23

asked: Jun 01 '11 at 07:23 PM

Seen: 391 times

Last Updated: Jun 01 '11 at 09:11 PM