Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This a test game (BETA)
- # Copyright Amir
- from time import sleep
- coins = 5000
- soldiers = 1000
- countries = 1
- commands = ["help", "balance", "soldiers", "territory", "buy"]
- first_time_balance = 0
- def start():
- print()
- print("This game is currently in BETA.")
- print()
- print("NOTE: On yes or no questions, say Y for yes, and N for no.")
- print()
- name = input("Hello, what's your name? ")
- print("Welcome,", name + ".")
- print("")
- sleep(1.5)
- print("""
- Your planet is called Utakis.
- There are 5 countries on your planet:
- - Plotus
- - Rakus
- - Kares
- - Tetrus
- - Yipis
- You are the king of Plotus.
- You have to conquer all the countries.
- You gain coins by conquering parts of countries (each country has 3 parts).
- You can buy more soldiers with those coins.
- You also get soldiers when you win fights, but you lose some when you lose those fights.
- You win fights when you have more soldiers then the enemy.
- You can't know how many soldiers the enemy has!""")
- print()
- play = input("Do you want to play this game? ")
- if play == "Y":
- begin_game()
- elif play == "N":
- print("Okay, bye!")
- def begin_game():
- print()
- print("""
- Here is the control box.
- You can write commands such as 'balance' or 'help'.
- Write 'balance' to check how much coins you have:""")
- control_box()
- def control_box():
- global first_time_balance
- command = input("")
- if command == commands[0]:
- print("""
- help: shows this page.
- balance: shows how much coins you have.
- soldiers: shows how many soldiers you have.
- territory: shows how much you expanded your country.
- buy: go to the shop.""")
- control_box()
- elif command == commands[1]:
- print("You have", coins, "coins.")
- print()
- first_time_balance += 1
- if first_time_balance == 1:
- achievement("Use balance for the first time.", 1000)
- control_box()
- elif command == commands[2]:
- print("You have", soldiers, "soldiers.")
- print()
- control_box()
- elif command == commands[3]:
- print("You have", countries, "countries.")
- print()
- control_box()
- elif command == commands[4]:
- shop()
- else:
- print("Error: type help to show all the commands.")
- print()
- control_box()
- def achievement(name, reward):
- global coins
- sleep(0.5)
- print("You just got an achievement:", name)
- coins += reward
- print("+", reward, "coins!")
- print()
- def shop():
- global soldiers
- global coins
- print("""
- You can buy:
- 1 - Soldiers (100 soldiers for 200 coins)""")
- buy_item = str(input("""
- Type the number you see before an item to buy this item.
- Type 'EXIT' to exit the shop.
- """))
- if coins <= 0:
- coins = 0
- print("You have 0 coins, so you were put back to the control box.")
- print()
- control_box()
- elif buy_item == "1":
- if coins < 200:
- print("Error: you don't have enough coins.")
- shop()
- soldiers += 100
- print("You now have", soldiers, "soldiers.")
- coins -= 200
- print("You now have", coins, "coins.")
- sleep(0.5)
- shop()
- elif buy_item == "EXIT":
- control_box()
- else:
- print("Error: incorrect typing.")
- shop()
- start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement