I followed the coding exactly and it still will not work. Please help.
var speed = 10.0;
var rotateSpeed = 3.0;
var bullitPrefab:Transform;
function Update ()
{
var controller : CharacterController = GetComponent(CharacterController);
//Rotate around y - axis
transform.Rotate(0,Input.GetAxis (“Horizontal”) * rotateSpeed, 0);
//Move forward/backward
var forward: Vector3 = transform.TransformDirection(Vector3.forward);
var curSpeed : float = speedInput.GetAxis(“Vertical”);
controller.SimpleMove(forwardcurSpeed);
if(Input.GetButtonDown(“Jump”));
{
var bullit = Instantiate(bullitprefab,transform.find(“SpawnPoint”).transform.position ,Quaternion.identity);
}
Here is the modified code, it should work properly, just make sure that you have a fireball prefab dragged onto the bullitPrefab variable and that you have a empty gameObject called SpawnPointer parented to the player/worm. And make sure that you use GameObject.Find instead of transform.find, or make a variable
var spawn : Transform;
and use it as
var bullit = Instantiate(bullitprefab, spawn.transform.position, Quaternion.identity);
In te if statement at the end and it should work.
var speed = 10.0;
var rotateSpeed = 3.0;
var bullitPrefab : Transform;
var controller : CharacterController;
function Start () {
controller = GetComponent(CharacterController);
}
function Update () {
transform.Rotate(0,Input.GetAxis ("Horizontal") * rotateSpeed, 0);
var forward: Vector3 = transform.TransformDirection(Vector3.forward);
var curSpeed : float = speed*Input.GetAxis("Vertical");
controller.SimpleMove(forward*curSpeed);
if(Input.GetButtonDown("Jump"))
{
var bullit = Instantiate(bullitprefab, GameObject.Find("SpawnPoint").transform.position, Quaternion.identity);
}
}
@script RequireComponent (CharacterController)