Quantcast
Channel: Questions in topic: "gun"
Viewing all articles
Browse latest Browse all 592

Using the arrow keys to shoot using c#

$
0
0
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!

Viewing all articles
Browse latest Browse all 592

Latest Images

Trending Articles



Latest Images

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