I am creating a text adventure in python and i want it to be different than the traditional turn-based gameplay. But also not the real time gameplay of a MUD. I have designed a method where the program asks you to input a certain string within a certain amount of seconds. E.g.
while goblin != str('dead'):
type 'slash at goblin' within 3 seconds.
if you succeed the program prints "you slash at the goblin, the goblin is now dead"
goblin == str('dead')
if you fail the program prints "the goblin slashes at you (-5 hp)."
hp == int(hp) - 5
and restarts the loop.
any ideas on how i could do this? how to force the program to type a command within a certain amount seconds? any help would be much appreciated THnx!