Quantcast
Channel: Questions in topic: "side scroller"
Viewing all articles
Browse latest Browse all 72

Side scroller shooter , not firing from character

$
0
0
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 :)

Viewing all articles
Browse latest Browse all 72

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>