Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- import sys
- from item import *
- from logs import *
- from termcolor import colored, cprint
- from PIL import Image
- from plays import play
- #shows the thing up top
- def game():
- cprint("""
- =====================
- Game
- =====================
- """, "green")
- #clears the screen
- def clear():
- print("\x1b[2J\x1b[H",end="")
- def start():
- global items
- clear()
- game()
- cprint("""
- 1) Login
- 2) Signup
- """, "red")
- #gets user's choice
- choice = input("> ")
- if choice == "1":
- clear()
- User=input("User Name: ")
- Password=input("Password: ")
- a, b=login(User, Password)
- if a == "User name or Password is incorrect!":
- print("User name or Password is incorrect!")
- else:
- #Go to menue. From menue have option to play game.
- menue(User, a, b, Pass=Password)
- if choice == "2":
- User=input("User Name: ")
- Password=input("Password: ")
- signup(User, Password, items)
- def menue(User, items, progress, Pass, gb=False):
- while True:
- clear()
- cprint("""
- =====================
- Menue
- =====================
- """, "green")
- cprint("1) Resume\n2) View items in inventory\n3) Save\n4) Exit")
- try:
- choice = input("> ")
- except KeyboardInterrupt:
- clear()
- a=input("Are you sure you want to exit? (Y or N): ")
- if a[0].lower() == "y":
- clear()
- sys.exit()
- if choice == "1":
- if gb == True:
- break
- else:
- play(User, items, progress, Pass)
- if choice == "2":
- clear()
- print("""
- Name | Quantity | Value |
- """)
- for i in items:
- for a in i:
- print(a)
- print()
- cprint("Press enter to return to menue. ", "green", end="")
- input()
- if choice == "3":
- save(User, Pass, items, progress)
- if choice == "4":
- clear()
- sys.exit()
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement