Quantcast
Channel: Questions in topic: "spawn points"
Viewing all articles
Browse latest Browse all 102

Problem creating a 2D scroller shooting game

$
0
0
Hello everyone , I have a problem with my 2D scroller shooting game (like metal slug), basically I'm not able to create a script to shoot in front of the player . I've created one , but the bullet doesn't move in front of the player , and it keep staying where it was spawned (the actual player position). Here's my script : var Sparo_pref : Transform; function Update () { if(Input.GetAxis("Spara")){ var bullet = Instantiate(Sparo_pref, Vector3(transform.position.x,transform.position.y,0), Quaternion.identity); bullet.rigidbody.AddForce(bullet.transform.forward * 5); } Can someone help me, please? I have been searching a solution for couple of days , but nothing happens... Edit : code sample ;)

Viewing all articles
Browse latest Browse all 102

Trending Articles



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