I’m teaching myself javascript and just finished watching some of the Tornado Twins, videos on youtube for their worm game.
I’m trying to edit their “moveraround” script, so that a “bullet,” is automatically fired from a spawn point ever 3 seconds. But, I suck at scripting and cant figure it out. Below is what I have so far, can anyone help?
var bullitPrefab : Transform;
function Update ()
{
var bullit = Instantiate(bullitPrefab, gameObject.Find(“spawnPoint”).transform.position,Quaternion.identity);
If it’s going to be firing every 3 seconds then you want a seperate function for where the bullet is firing. Then in your update you need an if statement comparing a cooldown variable to Time.deltaTime. So that you can have the shoot function be called depending on how long the cooldown time is. Right now how you have it setup bullets will just keep firing.