Hey I'm using this simple code for my player to shoot. But how do I get the player to shoot in each direction of the arrow keys? so far he only shoots right.
using UnityEngine;
using System.Collections;
public class arrowKeysShoot : MonoBehaviour {
public Transform Gun;
// Update is called once per frame
void Update () {
if (Input.GetKeyDown ("up")) {
Instantiate(Gun, transform.position,Quaternion.identity);
}
}
}
How can I get him to shoot up when up is pressed and etc for the other directions?
Thank you!
↧