[Solved] Need Help! Number Wizard in java?


Please note that the draw() function fires 60 times per second. Even after you call frameRate(1), the draw() function fires once per second. Further note that all of your logic is inside your draw() function. So the guessing will happen on an interval.

You’re also not checking whether the key is currently pressed. Note that the key and keyCode variables contain the most recently pressed key. You still need to check whether the key is currently pressed. You can use the keyPressed variable or the keyPressed() function for this.

If I were you, I’d modify my program to use the keyPressed() function to detect user input instead of polling for it in the draw() function.

Also, you need to get in the habit of debugging your code. Try to isolate the problem to a specific line of code that’s behaving differently from what you expected, instead of posting your full program and saying it’s not working.

1

solved Need Help! Number Wizard in java?