Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public GameObject UpArrow;
- public GameObject DownArrow;
- public GameObject LeftArrow;
- public GameObject RightArrow;
- float randomNumber;
- // Use this for initialization
- void Start()
- {
- }
- // Update is called once per frame
- void Update()
- {
- if (Input.GetKeyDown (KeyCode.DownArrow)) {
- randomNumber = Random.Range (7f, -7f); // this means use a random number between 7f and 0f
- Instantiate (DownArrow, new Vector3 (randomNumber, 6f, -6f), Quaternion.identity);
- }
- if (Input.GetKeyDown (KeyCode.UpArrow)) {
- randomNumber = Random.Range (-7f, 7f);
- Instantiate (UpArrow, new Vector3 (randomNumber, -6f, 6f), Quaternion.identity);
- }
- if (Input.GetKeyDown (KeyCode.LeftArrow)) {
- randomNumber = Random.Range (7f, -7f);
- Instantiate (LeftArrow, new Vector3 (7f, randomNumber, -7f), Quaternion.identity);
- }
- if (Input.GetKeyDown (KeyCode.RightArrow)) {
- randomNumber = Random.Range (-7f, 7f);
- Instantiate (RightArrow, new Vector3 (-7f, randomNumber, -7f), Quaternion.identity);
- }
- }
Add Comment
Please, Sign In to add comment