Skip to content

Fixes an issue where the menu screen continuously refreshed (blurry effect) whenever any key was pressed except 'p'.#2

Open
clerancebae wants to merge 1 commit intotimiscoding:masterfrom
clerancebae:fix-key-handling
Open

Fixes an issue where the menu screen continuously refreshed (blurry effect) whenever any key was pressed except 'p'.#2
clerancebae wants to merge 1 commit intotimiscoding:masterfrom
clerancebae:fix-key-handling

Conversation

@clerancebae
Copy link

Details

  • When pressing any key other than ‘p’ on the menu screen, the program entered an infinite loop because the key value was never updated correctly inside the input loop.
  • This caused the screen to flicker continuously (redrawing every cycle) and prevented any further key presses from being detected, including ‘p’.
  • As a result, the game could never start once a non-‘p’ key was pressed in the menu.

Fix

  • Properly initialize key and update it inside the loop using Keyboard.keyPressed(), ensuring the loop exits when a real key is pressed.

Result

  • The menu no longer flickers when pressing non-‘p’ keys, input is handled correctly, and the game starts normally when pressing ‘p’.

Initialize key variable and update while loop condition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant