itsThatCoderboy
itsThatCoderboy

Reputation: 51

How to skip checking for keys if no key is pressed

I am making a text-based game with frames, and my problem right now is that I have the code to check for keypresses

key = getkey.getkey()

But it seems like that command waits for you to press a key to continue with the code (that is, the command is blocking), and I would just like the game to continue updating, even if you don't press a key.

I was thinking of something like this:

import getkey

##Rest of my code

if key_pressed(any):
   key = getkey.getkey()

I'm using the getkey library, and I'm on the Replit webapp if that helps. I can't use something like msvcrt because I am on Linux.

Upvotes: 0

Views: 56

Answers (0)

Related Questions