how to make text game python code example

Example 1: how to make text game python

import time #this and time.sleep() is optional, I am just using it

#game
print('CoolKitty Presents')
time.sleep(2)
print('Text Game')
print('1 Start')
print('2 Exit')
start = int(input('Press Binded Number')) #this creates an input in the console for users to type
if start == 1: #If the user typed in 1
  print('Go To Place 1 Or Place 2?') #your script
  place = int(input('Place 1 Or Place 2?')) #creates another input in console
  if place == 1: #If they typed 1
    print('You are at place 1') #your script
    exit() # ends script
  if place == 2:
    print('You are at place 2') #your script
    exit() #ends script
if start == 2: # If 2 is typed in, you can also do more numbers then 2!
  exit() #ends program, repl.it might say have died, but that is normal.

Example 2: text based game python

x1=0
x2=0
x3=0
x4=0
x5=8
x6=0
x7=0
x8=0
x9=0
for x in "banana":
 print(x1, x2, x3)
 print(x4, x5, x6)
 print(x7, x8, x9)
 ducky=input("what to do ")
 if ducky == "left":
   x6=8
   x5=0
   print('\033[H\033[J', end='')

Tags:

Misc Example