samedi 1 mai 2021

How can you skip an input if no input is given?

I'm trying to make a game where a loop is constantly counting down, but where you can also input commands at any time. I'm using if input() ==command:, but that just seems to stop everything until input is given. I have tried looking into ways to get around this with things like multithreading, which was quite a few levels too advanced for me, and from msvcrt import getch, which wouldn't work for me, as I am not using windows, but instead, a chromebook.

The code I am using is here:

    while paused == False:
     time.sleep(.25)
     if coins >= upgradecost1 and input() == "u1":
      print("You upgraded " + str(choclate1) + ".")

Aucun commentaire:

Enregistrer un commentaire