# Why can't i firing a bullet when holding down left and up arrow keys by pressing space?

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);
}
``````

This is probably a limitation of your keyboard hardware. Keyboard keys form a matrix where each key connects a row to a column (8 rows and 16 columns, for instance). This arrangement allows detection of any two keys at the same time, but three or more keys may not be detected, depending on the rows and columns they connect. If three keys connect R1C1, R1C2 and R2C2, for instance, the circuit can’t identify all of them because they short circuit all four lines when pressed at the same time.

thank you aldonaletto, i kind of had a suspicion that it might be because of the keyboard but obviously wasn’t for sure…i had no idea thats how a key board worked

I have same problem , what is this???