I'm writing a small not-so-great game for a school coding "challenge" and I need to set a time limit on a certain action whilst introducing a press key to enter system. I have a full game timer, but my game is based on shooting aliens and I want a time limit for each wave before the alien shoots back. Also how can I get an input to auto-enter for the user? (e.g. to shoot, you have to press P, but in-game you have to type P then enter).
#Main Code
print("An Alien has appeared! They are shooting in 5 seconds!")
#MAIN TIMER START
start = time.time()
decision = input("Will you shoot (P) or deflect (O)?")
if input == "P":
decision = shoot
elif input == "p":
decision = shoot
elif input == "O":
decision = deflect
elif input == "o":
decision = deflect
restart()