I have coded a small game where you are stationary in the middle of the screen and you can hold down left arrow to fire left, up arrow to fire up, right arrow to fire…ETC
while i recently coded it that if you are holding both the up arrow and the right arrow you fire diagonally, every direction works (up/right, down/right, down/left) EXCEPT left/up
i wrote in a couple print statements and the game is reading me pressing down both the left and up arrow but the print statement within the firing code will not print so for some reason unity is no registering me pressing the space key when i have both the up and left arrow keys pressed…any help???
if (Input.GetKey("right")){
transform.Translate(Vector3.right * playerSpeed * Time.deltaTime);
}
if (Input.GetKey("left")){
transform.Translate(Vector3.left * playerSpeed * Time.deltaTime);
}
if (Input.GetKey("up")){
transform.Translate(Vector3.forward * playerSpeed * Time.deltaTime);
}
if (Input.GetKey("down")){
transform.Translate(Vector3(0,0,-1) * playerSpeed * Time.deltaTime);
}
if (Input.GetKey("right") && Input.GetKey("up")){
fireballScript.firingDirection = Vector3(-1,0,1);
}
//this is the one that is not working :-(
if (Input.GetKey("left") && Input.GetKey("up")){
fireballScript.firingDirection = Vector3(-1,0,1);
}
if (Input.GetKey("left") && Input.GetKey("down")){
fireballScript.firingDirection = Vector3(-1,0,1);
}
if (Input.GetKey("right") && Input.GetKey("down")){
fireballScript.firingDirection = Vector3(1,0,1);
}
if(Input.GetKeyDown("space")){
Instantiate(fireBall, fireSpawn[fireDirection].position, fireSpawn[fireDirection].rotation);
}