- Home /
Question by
MooseLordcoder · Feb 07 at 01:11 AM ·
2d gameshootingbullets
How can I get my bullet to shoot the other way when I face left. 2d
Here is the code:
public class Weapon : MonoBehaviour {
public Transform firePoint;
public GameObject bulletPrefab;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
Shoot();
}
}
void Shoot()
{
Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);
}
Comment
Answer by MooseLordcoder · Feb 07 at 01:15 AM
And for the bullets:
public class Weapon : MonoBehaviour {
public Transform firePoint;
public GameObject bulletPrefab;
// Update is called once per frame
void Update()
{
if (Input.GetButtonDown("Fire1"))
{
Shoot();
}
}
void Shoot()
{
Instantiate(bulletPrefab, firePoint.position, firePoint.rotation);
}
}
Your answer
Follow this Question
Related Questions
Bullet speed changes depending on how close and far I click the mouse button 2 Answers
Why will the bullets sometimes not show up in the game view when the player shoots? 0 Answers
RayCast Shooting And Errors 1 Answer
How can I make bullets shoot out of a plane? 1 Answer
How do I make a 2d bullet object move towards the players original position when it is spawned? 2 Answers