How to check if the pressed key is different than the expected key ?
I'm looking for something like this:
A letter appears and the player has to pressthe right key
X appears on the screen > Player has to press"X"
But if the player doesn't press the right key, he loses.
I tried:
if(Input.GetKeyDown() != keycode[X]) { "do something" }
but it doesnt seems to work :/
I didn't find any informations about this features, does anyone has a suggestion ? ^^
Answer by mf41z · Jan 15 at 04:59 PM
Maybe it's better if you do
if(Input.GetKeyDown(KeyCode.X))
{ "Do something when player pressed right key" }
else
{ "Do something when player pressed wrong key" }
I'm not sure if Input.GetKeyDown() works as you've done it, but try it as I've wrote.
Answer by Jerau · Jan 15 at 05:07 PM
In this case "else" include not pressing the right key, but also just do nothing..
Your answer
Follow this Question
Related Questions
Input.inputString and Input.GetKeyDown do nothing 0 Answers
How do you make a particle effect play on a key press? 0 Answers
C# Load Level after seconds+key press 1 Answer
(Input.GetKeyDown("space")) or (Input.GetKeyDown(KeyCode.Space))? 1 Answer
Multiple keydowns/coroutines cause unwanted angles in objects 0 Answers