Quantcast
Viewing latest article 1
Browse Latest Browse All 18

My bullet follows my plane...

I have a plane that shoots a bullet in 2d. One is called plane and the other called bullet! That simple! When I hit the space bar the bullet fires. If I hit the space bar and then move the plane the bullet playing its "bullet fire" animation the whole animation with the bullet moves:( I want the bullet to fire stay in one spot when the plane moves and hit something. But plane moves bullet moves... How can I fix this? Here are my codes... This is the bullet's code... function Update() { if(Input.GetButton("Jump")) { animation.Play("Bullet Fire"); } } Now here is the code for the plane... function Update() { if(Input.GetButton("Fire2")) { //do something transform.position.x += 0.3; } else if(Input.GetButton("Fire1")) { transform.position.x -= 0.3; } } function OnCollisionEnter (col : Collision) { if(col.gameObject.name == "enemy") { Destroy(gameObject); Destroy(col.gameObject); } } Thanks for helping!

Viewing latest article 1
Browse Latest Browse All 18

Trending Articles



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