I'm making a simplistic text adventure game for practice. I want players to be able to backtrack once they go farther into a scenario, for example after they go down a staircase I want them to be able to have "back" as an option and be able to retrace their steps.
I've already figured out every aspect of that except: How to clear the message that popped up telling them about the scenario they just entered.
I have code making their response a variable, and then determining if that variable is one of a set list of viable options, and if not looping them back to the start and deleting their previous entry with the line of code print("\033[A \033[A")
However, this code only deletes the last line of code, which varies wildly depending on screen ratio and different devices, and not the last output, which is the entire message that described to them the scenario.
Does anyone know a piece of code that can either
- delete the entire last output of the console, in this case a printed line of code which exceeds one line and may extend for as many as 8-10 lines, detailing their scenario, or
- clear the console and then warp them back to my predefined starting point (Example:
def start0():
), because after I clear the console the codestart0()
doesn't work.