Two problems at the same time!

Here it goes...

I made a turret with a script like this:

var LookAtTarget:Transform;
var damp = 6.0;
var bullitPrefab:Transform;
var savedTime;

function Update () 
        var rotate = Quaternion.LookRotation(LookAtTarget.position - transform.position);

        transform.rotation = Quaternion.Slerp(transform.rotation, rotate, Time.deltaTime * damp);

        var seconds: int = Time.time;
        var oddeven = (seconds % 2);



function Shoot(seconds)
        var bullit = Instantiate(bullitPrefab, transform.Find("spawnPoint.").transform.position, Quaternion.identity);

        bullit.rigidbody.AddForce(transform.forward * 1200);


And I instructed it to shoot fireballs. Now. The problem is that it doesn't shoot at me at all. It's just following.

Now for the second question...

I made a fireball prefab and ascript to make them disappear after some time. The script looks like this:

var lifeTime = 2.0;

function Awake()

The problem is, that when I put this script into the prefab. the fireballs just don't appear (I've tried shooting with my character). When I remove the script from the prefab. The character starts shooting again, but the fireballs don't disappear.


I don't think you need the condition in the Shoot(seconds). It is already called when oddeven is true.

For your second question:

You are destroying your object on instantiation. Try this: function Awake(){ Destroy(gameObject, lifeTime);} }

Does your turret actually contain a child named "spawnPoint." (with a period at the end)? The script works fine provided the turret object's transform is set up correctly and the bullet prefab has a rigidbody.