I'm a bit stuck debugging a script. It's actually hurting my brain.
I've got a shark moving in a circle and I've used a bit of script from the robot (badguy) script in the Lurpz tutorial and using a capsule collider to trigger it. It worked the 1st time by bumping my character backwards and removing health points, but had a script error. Now after restarting Unity the game won't run because of the error. See below.
assets/scripts/SharkAttack.js (43,59):BCE0044: expecting :, found ';'
I can't figure it out as I've tried putting in a : which obviously doesn't work.
Below is my script. Any help debugging it would be most appreciated. I'm a bit of a coding noob being an artist by trade.
var damage = 1;
var target : Transform;
// Cache a reference to the controller
private var characterController : CharacterController;
characterController = GetComponent(CharacterController);
// Cache a link to LevelStatus state machine script:
var levelStateMachine : LevelStatus;
function Start ()
levelStateMachine = GameObject.Find("/Level").GetComponent(LevelStatus);
Debug.Log("Shark: ERROR! NO LEVEL STATUS SCRIPT FOUND.");
target = GameObject.FindWithTag("Player").transform;
function OnTriggerEnter (col : Collider)
var controller : ThirdPersonController = col.GetComponent(ThirdPersonController);
if (controller != null)
// Keep looking if we are hitting our target
// If we are, knock them out of the way dealing damage
//var pos = transform.TransformPoint(punchPosition);
//if(Time.time > 0.3 && (pos - target.position).magnitude < punchRadius)
// deal damage
// knock the player back and to the side
var slamDirection = transform.InverseTransformDirection(target.positio n - transform.position);
slamDirection.y = 0;
slamDirection.z = 1;
if (slamDirection.x >= 0)
slamDirection.x = 1;
slamDirection.x = -1;
lastPunchTime = Time.time;
Here's a bit of an old link to the game I'm working on if it helps.
Thanks again for any help.