Free Game
|.'', ,''.| N |.'.'', ,''.'.| W + E |.'.'.'', ,''.'.'.| S |.'.'.'.'', ,''.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |,',',',',| |,',',',',| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.'.| |.'.'.'.',' /*********\ ','.'.'.'.| |.'.'.',' /***********\ ','.'.'.| |.'.',' /*************\ ','.'.| |.',' /***************\ ','.| |;____________/*****************\____________;|
The second part of the Mythix game. Explore an underground passage. To import the progress from the previous game make sure that the ms1.json is in the location as the Mythix2.py file.
import json
import os
def title(name):
if name == "":
name = input("Enter your name: ")
print("███ ███ ██ ██ ████████ ██ ██ ██ ██ ██ ██████ \n"
"████ ████ ██ ██ ██ ██ ██ ██ ██ ██ ██ \n"
"██ ████ ██ ████ ██ ███████ ██ ███ █████ \n"
"██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ \n"
"██ ██ ██ ██ ██ ██ ██ ██ ██ ███████ \n")
print(f" Welcome Back {name}")
print(" The story continues as you find yourself\n in an underground tunnel")
print(" Enter 1: To continue, Press 0 to exit")
return name
def underground_one(blue, reset):
print(blue)
print("|.'', ,''.|\n"
"|.'.'', ,''.'.|\n"
"|.'.'.'', ,''.'.'.|\n"
"|.'.'.'.'', ,''.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|,',',',',| |,',',',',|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.',' /*********\\ ','.'.'.'.|\n"
"|.'.'.',' /***********\\ ','.'.'.|\n"
"|.'.',' /*************\\ ','.'.|\n"
"|.',' /***************\\ ','.|\n"
"|;____________/*****************\\____________;|\n")
print(reset)
print(" An underground passage. Only exit is 'N'.")
return True
def underground_two(blue, reset):
print(blue)
print("|.'', ,''.|\n"
"|.'.'', ,''.'.|\n"
"|.'.'.'', ,''.'.'.|\n"
"|.'.'.'.'', ,''.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'O'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|,',',',',| |,',',',',|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.',' /*********\\ ','.'.'.'.|\n"
"|.'.'.',' /***********\\ ','.'.'.|\n"
"|.'.',' /*************\\ ','.'.|\n"
"|.',' /***************\\ ','.|\n"
"|;____________/*****************\\____________;|\n")
print(reset)
print(" An underground passage. Exits is 'N' and 'S'.")
return True
def underground_three(blue, reset):
print(blue)
print("|.'', ,''.|\n"
"|.'.'', ,''.'.|\n"
"|.'.'.'', ,''.'.'.|\n"
"|.'.'.'.'', ,''.'.'.'.|\n"
"|.'.'.'.'.| ||||||||||||||||||||||.'.'.'.'.|\n"
"|.'.'.'.'.| ||||||||||||||||||||||.'.'.'.'.|\n"
"|.'.'.'.'.| ||||||||||||||||||||||.'.'.'.'.|\n"
"|.'.'.'.'.| ||||||||||||||||||||||.'.'.'.'.|\n"
"|.'.'.'.'.| ||||||||||||||||||||||.'.'.'.'.|\n"
"|,',',',',| ||||||||||||||||||||||,',',',',|\n"
"|.'.'.'.'.| ||||||||||||||||||||||.'.'.'.'.|\n"
"|.'.'.'.'.| ||||||||||||||||||||||.'.'.'.'.|\n"
"|.'.'.'.'.| ||||||||||||||||||||||.'.'.'.'.|\n"
"|.'.'.'.'.|*************************|.'.'.'.'.|\n"
"|.'.'.'.',' /*********\\ ','.'.'.'.|\n"
"|.'.'.',' /***********\\ ','.'.'.|\n"
"|.'.',' /*************\\ ','.'.|\n"
"|.',' /***************\\ ','.|\n"
"|;____________/*****************\\____________;|\n")
print(reset)
print(" An underground passage. Exits are 'W' and 'S'.")
return True
def underground_four(blue, reset):
print(blue)
print("|.'', ,''.|\n"
"|.'.'', ,''.'.|\n"
"|.'.'.'', ,''.'.'.|\n"
"|.'.'.'.'', ,''.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|,',',',',| |,','O',',|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.',' /*********\\ ','.'.'.'.|\n"
"|.'.'.',' /***********\\ ','.'.'.|\n"
"|.'.',' /*************\\ ','.'.|\n"
"|.',' /***************\\ ','.|\n"
"|;____________/*****************\\____________;|\n")
print(reset)
print(" An underground passage. Exits are 'W' and 'E'.")
return True
def underground_five(blue, reset):
print(blue)
print("|.'', ,''.| W\n"
"|.'.'', ,''.'.| S + N\n"
"|.'.'.'', ,''.'.'.| E\n"
"|.'.'.'.'', ,''.'.'.'.|\n"
"|.'.'O'.'.||||||||||||||||||||||| .'.'.'.'.|\n"
"|.'.'.'.'.||||||||||||||||||||||| .'.'.'.'.|\n"
"|.'.'.'.'.||||||||||||||||||||||| .'.'.'.'.|\n"
"|.'.'.'.'.||||||||||||||||||||||| .'.'.'.'.|\n"
"|.'.'.'.'.||||||||||||||||||||||| .'.'.'.'.|\n"
"|,',',',',||||||||||||||||||||||| ,',',',',|\n"
"|.'.'.'.'.||||||||||||||||||||||| .'.'.'.'.|\n"
"|.'.'.'.'.||||||||||||||||||||||| .'.'.'.'.|\n"
"|.'.'.'.'.||||||||||||||||||||||| .'.'.'.'.|\n"
"|.'.'.'.'.|*************************|.'.'O'.'.|\n"
"|.'.'.'.',' /*********\\ ','.'.'.'.|\n"
"|.'.'.',' /***********\\ ','.'.'.|\n"
"|.'.',' /*************\\ ','.'.|\n"
"|.',' /***************\\ ','.|\n"
"|;____________/*****************\\____________;|\n")
print(reset)
print(" An underground passage. Exits are 'N' and 'E'.")
return True
def underground_six(blue, reset):
print(blue)
print("|.'', ,''.|\n"
"|.'.'', ,''.'.|\n"
"|.'.'.'', ,''.'.'.|\n"
"|.'.'.'.'', ,''.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| .-. |.'.'.'.'.|\n"
"|.'.'.'.'.| (O,O) |.'.'.'.'.|\n"
"|.'.'.'.'.| |-| |.'.'.'.'.|\n"
"|.'.'.'.'.| __|__ |.'.'.'.'.|\n"
"|,',',',',| //.=|=.\\\\ |,',',',',|\n"
"|.'.'.'.'.| // .=|=. \\\\ |.'.'.'.'.|\n"
"|.'.'.'.'.| \\\\ .=|=. // |.'.'.'.'.|\n"
"|.'.'.'.'.| \\\\(_=_)// |.'.'.'.'.|\n"
"|.'.'.'.'.| (:| |:) |.'.'.'.'.|\n"
"|.'.'.'.',' || || ','.'.'.'.|\n"
"|.'.'.',' () () ','.'.'.|\n"
"|.'.',' || || ','.'.|\n"
"|.',' #=' '=# ','.|\n"
"|;___________________________________________;|\n")
print(reset)
print(" A Skeleton monster is blocking your way.")
print(" A chill goes down your spine\n")
return True
def underground_seven(blue, reset):
print(blue)
print("|.'', ,''.|\n"
"|.'.'', ,''.'.|\n"
"|.'.'.'', ,''.'.'.|\n"
"|.'.'.'.'', ,''.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| _.------. |.'.'.'.'.|\n"
"|.'.'.'.'.| / \\ |.'.'.'.'.|\n"
"|.'.'.'.'.| | o o | |.'.'.'.'.|\n"
"|.'.'.'.'.| | vvvvv | |.'.'.'.'.|\n"
"|,',',',',| | ^^^^^ | |,',',',',|\n"
"|.'.'.'.'.| | | |.'.'.'.'.|\n"
"|.'.'.'.'.| \\________/ |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.',' ','.'.'.'.|\n"
"|.'.'.',' ','.'.'.|\n"
"|.'.',' ','.'.|\n"
"|.',' ','.|\n"
"|;____________________________________________;|\n")
print(reset)
print(" A Ghost monster is blocking your way.")
print(" Deadly Silence.\n")
return True
def underground_eight(blue, reset):
print(blue)
print("|.'', ,''.|\n"
"|.'.'', ,''.'.|\n"
"|.'.'.'', ,''.'.'.|\n"
"|.'.'.'.'', ,''.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| \\ / |.'.'.'.'.|\n"
"|.'.'.'.'.| o ^ o |.'.'.'.'.|\n"
"|.'.'.'.'.| \\( ) / |.'.'.'.'.|\n"
"|.'.'.'.'.|_____) (_____ |.'.'.'.'.|\n"
"|,',',',',|( ) ( ) |,',',',',|\n"
"|.'.'.'.'.|(_____ _____) |.'.'.'.'.|\n"
"|.'.'.'.'.| (__( )__) |.'.'.'.'.|\n"
"|.'.'.'.'.| //( )\\\\ |.'.'.'.'.|\n"
"|.'.'.'.'.| ( ) |.'.'.'.'.|\n"
"|.'.'.'.',' ( ) ','.'.'.'.|\n"
"|.'.'.',' ! ','.'.'.|\n"
"|.'.',' ','.'.|\n"
"|.',' ','.|\n"
"|;____________________________________________;|\n")
print(reset)
print(" An Incest Monster is Blocking your way.")
print(" You feel a stillness.\n")
return True
def underground_nine(blue, reset):
print(blue)
print("|.'', ,''.|\n"
"|.'.'', ,''.'.|\n"
"|.'.'.'', ,''.'.'.|\n"
"|.'.'.'.'', ,''.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| |.'.'.'.'.|\n"
"|.'.'.'.'.| ------------------- |.'.'.'.'.|\n"
"|.'.'.'.'.| | | |.'.'.'.'.|\n"
"|.'.'.'.'.| | | |.'.'.'.'.|\n"
"|,',',',',| | 0 0 0 | |,',',',',|\n"
"|.'.'.'.'.| | 1 2 3 | |.'.'.'.'.|\n"
"|.'.'.'.'.| | | |.'.'.'.'.|\n"
"|.'.'.'.'.| | | |.'.'.'.'.|\n"
"|.'.'.'.'.| | | |.'.'.'.'.|\n"
"|.'.'.'.',' /*********\\ ','.'.'.'.|\n"
"|.'.'.',' /***********\\ ','.'.'.|\n"
"|.'.',' /*************\\ ','.'.|\n"
"|.',' /***************\\ ','.|\n"
"|;____________/*****************\\____________;|\n")
print(reset)
print(" At the end of the corridor is a wall with 3 buttons.")
print(" Press E to examine.")
return True
def death(color, reset):
print(color)
print(" ,..,.\n"
" { }\n"
" /, }\n"
" / `/`\n"
" __, / /\n"
" {_'-/.__/\n"
" `/-.__/._\n"
" / ' /`\\_}\n"
" / ' / \n"
" ____ / ' /\n"
" ,-'---- --/ ' /_\n"
" ' ``~~~%%',\n"
" ( % Y\n"
" { %% I\n"
" { - % `.\n"
" O ', % )\n"
" I | ,..__ __. U\n"
" I .,_./ Y ' / ^Y J )|\n"
" \\ |' / | | ||\n"
" \\ L_/ . _ (_,.'(\n"
" \\, , ^^""' / | )\n"
" \\_ \\ /,L] /\n"
" '-_`-, ` ` ./`\n"
" `-(_ )\n"
" ^^\\..___,.--`\n")
print(reset)
print(" You died! Make sure you found and used the right weapon")
print(" correct monster.")
print(" Press enter to exit")
return False
def battle(attack, enemy, game_score, inventory):
info = " You killed the Monster and moved on to the next area"
if enemy == "u6" and attack == "2" and "lit-torch" in inventory:
info += "\n You hear a 'TA' sound"
room = "u7"
game_score += 3
elif enemy == "u7" and attack == "1" and "tuning-fork" in inventory:
room = "u8"
info += "\n You hear a 'DA' sound"
game_score += 3
elif enemy == "u8" and attack == "3" and "fan" in inventory:
room = "u9"
info += "\n You hear a 'AH' sound"
game_score += 3
else:
info = ""
room = "dead"
return room, info, game_score
def ending(color, reset):
print(color)
print(" ⣿⣿⣿⣿⣿⣿⣿⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⣿⣿⣿⣿⣿⣿⣿\n"
" ⣿⣿⣿⣿⣿⣿⣿⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣤⣿⣿⣿⣿⣿⣿⣿\n"
" ⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿\n"
" ⣿⣿⣿⣿⣿⣿⣿⠿⠶⠶⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠶⠶⠿⣿⣿⣿⣿⣿⣿⣿\n"
" ⣿⣿⣿⣿⣿⣿⣿⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣀⣿⣿⣿⣿⣿⣿⣿\n"
" ⣿⣿⣿⣿⣿⣿⣿⣿⠉⠉⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠉⠉⣿⣿⣿⣿⣿⣿⣿⣿\n"
" ⣿⣿⣿⣿⣿⣿⣿⣿⣤⣤⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣤⣤⣿⣿⣿⣿⣿⣿⣿⣿\n"
" ⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿\n"
" ⣿⣿⣿⣿⣿⣿⣿⣿⠛⠛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠛⠛⣿⣿⣿⣿⣿⣿⣿⣿\n"
" ⣿⣿⣿⣿⣿⣿⣿⣿⣀⣀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣀⣀⣿⣿⣿⣿⣿⣿⣿⣿\n"
" ⣿⣿⣿⣿⣿⣿⣿⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⠉⣿⣿⣿⣿⣿⣿⣿\n"
" ⣿⣿⣿⣿⣿⣿⣿⣶⠶⠶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⠶⠶⣶⣿⣿⣿⣿⣿⣿⣿\n")
print(" The ground shakes and the wall in front of you rises up.")
print(" In the next room there is a ladder tha goes up.")
print(" You climbed up.")
print(" End of Part 2. To be continued!")
print(" Score saved. You can use the save,json file to")
print(" import the score into the third part of the game.")
print(" Press enter to exit.")
return False
def main():
print()
# Initialize game variables
# variables
loop = True
room = 'title'
info = ""
game_score = 0
name = ""
direction = "n"
# Colors
color = ''
green = '\033[32m'
yellow = '\033[33m'
blue = '\033[34m'
reset = '\033[m'
red = '\033[31m'
search_counter = 0
inventory = []
rooms = {
"u1": underground_one,
"u2": underground_two,
"u3": underground_three,
"u4": underground_four,
"u5": underground_five,
"u6": underground_six,
"u7": underground_seven,
"u8": underground_eight,
"u9": underground_nine,
"dead": death,
"end": ending,
}
colors = {
"u1": blue,
"u2": blue,
"u3": blue,
"u4": blue,
"u5": blue,
"u6": blue,
"u7": blue,
"u8": blue,
"u9": blue,
"dead": green,
"end": green,
}
move_south = {
"u2": "u1",
"u3": "u2",
}
move_north = {
"u1": "u2",
"u2": "u3",
"u5": "u6",
}
move_west = {
"u3": "u4",
"u4": "u5",
}
move_east = {
"u5": "u4",
"u4": "u3",
}
no_action_rooms = [
'exit',
'title',
'end',
"u6",
"u7",
"u8",
"dead",
]
battle_rooms = [
"u6",
"u7",
"u8"
]
# Try to load save data from precious part
if os.path.exists('ms1.json'):
with open('ms1.json', 'r') as sv:
loaded_data = json.load(sv)
game_score = loaded_data['game_score']
name = loaded_data['name']
info = " Import successful"
# Main game loop
while loop:
if room == 'title':
name = title(name)
print("*" * 60)
print(f" Name: {name}", end="")
space = 45 - len(name)
print(" " * space, end="")
print(f"Score: {game_score}")
if room in rooms:
loop = rooms[room](color, reset)
if room not in no_action_rooms:
print(green)
if direction == "n":
print(" ⣿⣿⣿N⣿⣿⣿")
print(" ⣿W + E⣿")
print(" ⣿⣿⣿S⣿⣿⣿")
if direction == "s":
print(" ⣿⣿⣿S⣿⣿⣿")
print(" ⣿E + W⣿")
print(" ⣿⣿⣿N⣿⣿⣿")
if direction == "e":
print(" ⣿⣿⣿E⣿⣿⣿")
print(" ⣿N + S⣿")
print(" ⣿⣿⣿W⣿⣿⣿")
if direction == "w":
print(" ⣿⣿⣿W⣿⣿⣿")
print(" ⣿S + N⣿")
print(" ⣿⣿⣿E⣿⣿⣿")
print(reset)
print(" Enter the letters corresponding exits to go there")
print(" Enter 'F' to search, Enter 'I' for Inventory")
# Fighting Attacks
if room in battle_rooms:
if "tuning-fork" in inventory:
print(" 1.Tuning Fork ", end="")
if "lit-torch" in inventory:
print(" 2.Lit-Torch ", end="")
if "fan" in inventory:
print(" 3.Hand Fan ", end="")
print()
# Display Text and input prompt
print(yellow + info + reset)
info = ""
print("*" * 60)
command = input(" Command: ")
command = command.lower()
if command == "0":
loop = False
if command == "1" and room == "title":
room = "u1"
# Search area actions
if command == "f":
info = " You searched the area but found nothing"
if room == 'u2':
if "matches" not in inventory:
if "torch" not in inventory:
info = " You found a torch"
inventory.append("torch")
game_score += 1
else:
if "lit-torch" not in inventory:
info = " You found a torch and you lit with the matches"
inventory.append("lit-torch")
game_score += 2
if room == 'u4':
if "tuning-fork" not in inventory:
info = " You found a tuning fork."
inventory.append("tuning-fork")
game_score += 1
if room == 'u5':
if search_counter == 0:
if "fan" not in inventory:
info = " You found a hand fan"
inventory.append("fan")
search_counter = 1
game_score += 1
elif search_counter == 1:
if "torch" not in inventory:
if "matches" not in inventory:
info = " You found matches"
inventory.append("matches")
game_score += 1
else:
if "lit-torch" not in inventory:
info = " You found matches and used them to lit the torch"
inventory.append("lit-torch")
game_score += 2
# Movements
if command == 's':
if room in move_south:
room = move_south[room]
direction = 's'
elif command == 'n':
if room in move_north:
room = move_north[room]
direction = 'n'
elif command == 'e':
if room in move_east:
room = move_east[room]
direction = 'e'
elif command == 'w':
if room in move_west:
room = move_west[room]
direction = 'w'
elif room in battle_rooms:
room, info, game_score = battle(command, room, game_score, inventory)
if command == "e" and room == "u9":
print(" You examine the buttons.")
print(" The first one makes an 'DA' sound when you pressed it.")
print(" The second one makes an 'TA' sound when you pressed it.")
print(" The third one makes an 'AH' sound when you pressed it.")
print(" Press switches in the right order")
puzzle = input(" For example 1,2,3: ")
if puzzle == "2,1,3" or puzzle == "2,1,3,":
game_score += 5
data_to_save = {
"name": name,
"game_score": game_score,
}
with open('ms2.json', 'w') as sv:
json.dump(data_to_save, sv)
room = "end"
else:
info = " Nothing happens"
if command == "xyzzy":
info = " Unfortunately nothing happens this time."
if command == 'i':
print("*" * 60)
print(" Inventory: ")
print(red, inventory, reset)
if room in colors:
color = colors[room]
main()