In my side scroller
I have a character which i can move around…
i have bullets which destroy themselves after the screen !
i attached the fire script to the character… but when I do fire with space or mouse, the bullets are instantiated, but fire from another origin ! they dont fire from my character !
the bullets move according to my character… but it originates from another place !
var laser : GameObject;
function Update () {
if (Input.GetButtonDown("Fire1"))
{
Fire();
}
}
function Fire()
{
Instantiate(laser,transform.position, transform.rotation);
}
and this is how the bullets move !
I dont know where i have gone wrong…
var laserSpeed : float;
function Start () {
}
function Update () {
transform.Translate(laserSpeed * Time.deltaTime,0,0);
if(transform.position.x>6){
Destroy(gameObject);
}
}
thanks in advance :)