Batman tales of the night
#Jose R. Rodriguez
#date: 11-10-2020
#Class: Python Programming 1
#Assignment: Final Project - OOP Application
#--------------------------------------------------------------------------------------------#
#--------------------------------------------------------------------------------------------#
import emojis
import wikipedia
import tkinter as tk
from random import choice
from random import shuffle
health = 100 #global variable health
left = 10
right = 10
root = tk.Tk() #stablishing the root or window
class person: #Creating a super class
def init(self): #inializing the super class
pass
def character(self, name, alias):#creating a child class characters
self.name = name #name it will be equal to name
self.alias = alias #alias will be equal to alias
def prog_instruction():
print("""Hi, this python program is a game base program, on one of the most famous super hero "BATMAN".
This program is actually a two part game.The first one just program base of words of input and output between the user & the program.
The second a graphic interactive game make as a GUI with the library tkinter
In the first part of the game you will go thru the story reading and taking action depending on your input.
In the second part you will get to choose to play and interactive word jungle game or to see the bonus information from the story.
Either way is a ton of fun and you have the control of what to do.
Let start with the program\n\n""")
def welcome_message():#creating a welcome function
print("\nWelcome to BATMAN - Tales Of The Night\n\n")#display title
print("""A new day dawns in Gotham... Robin has been kidnapped, a villainous
scheme is afoot, and a mysterious pall hangs over the city... In this thrilling
continuation of the epic text-based Bat-Saga, The Adventures of Batman,
play as BATMAN as he struggles to unravel the confounding conundrums of
Gotham's most esoteric evildoer, THE RIDDLER, going to any lengths
necessary to save his young ward ROBIN and protect the city of Gotham from
any and all vile villains who would seek to conquer it. Will you help Batman
solve Nygma's latest baffling caper, or will the people of Gotham be forced to
surrender to his sadistic whims? (it depends on if you play it or not, honestly.)""")#display message
def Batman():#creating function for batman character
batman_info = """\nBATMAN\n\nA playboy billionaire by day, Bruce Wayne’s double life affords him the comfort of a life
without financial worry, a loyal butler-turned-guardian and the perfect base of
operations in the ancient network of caves beneath his family’s sprawling estate.
By night, however, he sheds all pretense, dons his iconic scalloped cape and pointed cowl
and takes to the shadowy streets, skies and rooftops of Gotham City.
Bruce Wayne wages eternal war on the criminals of Gotham City. He is vengeance. He is the night. He is Batman."""#display message
return batman_info
def alfred():#creating function for alfred character
alfred_info = """\nAlfred\n\nA British special forces veteran turned butler, Alfred Pennyworth is the most loyal
friend and confidant of both Bruce Wayne and Batman.
Alfred Pennyworth is more than just Bruce Wayne’s butler, or Batman’s confidant.
Alfred is a second father to Wayne, and serves as his conscience when the never-
ending fight against evil wears on the Caped Crusader.
As a former British intelligence officer, field medic and trained Shakespearean actor,
Alfred is uniquely suited to support the lives of masked crime fighters. He's quick with
a disguise, a cover story, an alibi; and quicker still with a suture, a cast or an ice bath.
He ensures that Wayne Manor—all of Wayne Manor, including the vast Batcave—is
operating at peak performance while the Bat-Family patrols the city."""#display message
return alfred_info
def riddler():#creating function for riddler character
riddler_info = """\n\nRiddler\nOne of the Dark Knight's most infamous villains, Edward Nygma enjoys flaunting his
intellectual superiority by conducting crimes and leaving clues for Batman to piece
together. While this habit constantly leads to the aptly named Riddler failing in his
criminal endeavors, his puzzle-problem actually stems not only from his own
narcissism and ego, but also from a deep-seeded psychological compulsion. Because of
this, the Riddler often finds himself a resident of Arkham Asylum following his
inevitable capture."""#display message
return riddler_info
def bane():#creating function for bane character
bane_info = """\n\nBane\nRaised in a prison on the island of Santa Prisca for the crimes of his father, Bane
dedicated his life to honing his mind and body into a perfect weapon.
Bane was raised without pity or compassion. As an adult, he served as a test subject for the super-steroid called Venom.
Superhumanly strong, Bane escaped his hell and headed to Gotham City—
where he chose to make his mark by defeating the Batman.
Though he succeeded, their initial battle was far from their last."""#display message
return bane_info
def user_info():# getting user info funtion
user_name = input("\nWelcome, what is your name? ")# variabe holding user info
print("\nHi ", user_name) #welcome user input
play = False # variable holding boolean for while loop
while play == False:
user_play = input("\nare you ready to start this adventure? ") # variable holding user input to play or not play the game
if user_play == "yes": #if statement if user input yes do something
play = True # variable holding a boolean to break the while loop
elif user_play == "no": #if statement if user input no do something
print("OK, I guess you didn't want to play an awesome super heroe") #display message
play = True #variable holding a boolean to break the while loop
quit() #command to quit the game
else: # else statement if the user input answer is not correct
print(emojis.encode(":thumbsdown: \n"),"That is not a write answer, sorry try yes or no") # display message
play = False #variable holding a boolean to keep the while loop
def characters_info(batman_info,alfred_info,riddler_info,bane_info): #main characters information function
user_answer_info = input("\nBefore you start the game, there is some main characters on the game, would you like to get information about them? ")#getting user input into get information about the characters
if user_answer_info == "yes": #if statement if user pick yes to do something
print("\nThe characters are: Batman, Alfred, Riddler & Bane")#display characters
user_choose = input("\nWhich character would you like to get info: ") #variable to hold user input
if user_choose == "Batman": # if statement if user pic batman to do something
print(batman_info) #display batman info
elif user_choose == "Alfred": # if statement if user pic alfred to do something
print(alfred_info) #display alfred info
elif user_choose == "Riddler": # if statement if user pic riddler to do something
print(riddler_info) #display riddler info
elif user_choose == "Bane": # if statement if user pic bane to do something
print(bane_info) #display bane info
elif user_answer_info == "no": # if user choose not to get any info about the character to keep going
print("Ok, you missed some awesome information")
pass
def characters_id():
user_answer_id = input("\nwould you like to know the characters secret identity ")#getting user input into get information about the characters
if user_answer_id == "yes": #if statement if user pick yes to do something
print("\nThe characters are: Batman, Alfred, Riddler & Bane")#display characters
user_choose = input("\nWhich character would you like to know the secret identity: ") #variable to hold user input
if user_choose == "Batman": # if statement if user pic batman to do something
Batman = person() #variable is holding class properties
Batman.name ="Batman" #batman variable holding a string
Batman.alias="Bruce Wayne" #batman variable holding a string inherit properties from class
print("\n",Batman.name, "is: ", Batman.alias) #display variables and properties
elif user_choose == "Alfred": # if statement if user pick alfred to do something
Alfred = person() #variable is holding class properties
Alfred.name ="Alfred" #Alfred variable holding a string
Alfred.alias="Alfred" #Alfred variable holding a string inherit properties from class
print("\n",Alfred.name, "is: ", Alfred.alias)
elif user_choose == "Riddler": # if statement if user pick riddler to do something
Riddler = person() #variable is holding class properties
Riddler.name ="Riddler" #Riddler variable holding a string
Riddler.alias="Edward Nygma" #Riddler variable holding a string inherit properties from class
print("\n",Riddler.name, "is: ", Riddler.alias) #display variables and properties
elif user_choose == "Bane": # if statement if user pick bane to do something
Bane = person() #variable is holding class properties
Bane.name ="Bane" #bane variable holding a string
Bane.alias="Pena Duro" #Bane variable holding a string inherit properties from class
print("\n",Bane.name, "is: ", Bane.alias) #display variables and properties
else: #else statement
print("That is not a correct character") #display message if answer is incorrect
characters_id() #call characters id funtion when answer is incorrect
def storyline(): #creating function storyline
s1 = print("""\nA new day dawns in the Batcave. The clear light of morning does not seem to reach Batman,
however, as he sits in front of the Batcomputer, lost in dark and brooding thoughts.
"It's morning, Alfred," Batman says to his loyal butler, "but we're both still in the dark."
"Might that be because the Batcave is underground, Master Bruce?" says Alfred, getting an early head start on his daily quip quota.
"That's not what I mean, Alfred," Batman replies, and it isn't. Batman means that, irritating as he may be, his sidekick Robin
is still missing, and is likely in the clutches of one of Batman's oldest and cleverest foes.
And only you, bold player, are capable of helping Batman recover his young ward, keep Gotham City protected, and bring to
justice the supervillain in question.""") #display story 1
automobiles = ["batmobile", "batplane", "batcycle","batboat","batcopter"] #list of batman's vehicles
s2 = print("""\nBatman is about to go inspect the city, to try to find his sidekick Robin.
here is the vehicles to choose: """) # display story 2
print("there is ", len(automobiles), "to choose\n") # display the lenght of the list
print(automobiles) #display list
user_vehicle_choice = False #variable holding a boleean for while loop
while user_vehicle_choice == False: #while loop
user_vehicle = input("which one you would like to choose: ") #variable holding user choice
if user_vehicle == "batmobile": #if statement if user choose batmobile to do something
print("\nThe Batmobile is fast and equipped with so many weapons, definetely can take anything") #display message
print("Great choice lets drive around Gothan City") #display message
user_vehicle_choice = True #variable holding the boleean to break the while loop
elif user_vehicle == "batplane": #elif statement if user choose batplane to do something
print("\nThe Batplane fast like the wind, you can definetely capture the enemies with the eagle eye") #display message
print("Great choice lets flight around Gothan City") #display message
user_vehicle_choice = True #variable holding the boleean to break the while loop
elif user_vehicle == "batcycle": #elif statement if user choose batcycle to do something
print("\nThe Batcycle fast and small enough to pass to narrow places") #display message
print("Great choice lets drive around Gothan City") #display message
user_vehicle_choice = True #variable holding the boleean to break the while loop
elif user_vehicle == "batboat": #elif statement if user choose batboat to do something
print("\nThe Batboat a beast on the sea,a an it could change to a submarine to be undetected") #display message
print("Great choice lets sail around Gothan City") #display message
user_vehicle_choice = True #variable holding the boleean to break the while loop
elif user_vehicle == "batcopter": #elif statement if user choose batcoter to do something
print("\nThe Batcoter hover over enemys with xray vision and massive automative weapons") #display message
print("Great choice lets flight around Gothan City") #display message
user_vehicle_choice = True #variable holding the boleean to break the while loop
else: # else statement if the user input wrong answer
print("\nSorry that is not a right answer") #display message
print(emojis.encode("\n:no_entry_sign: ")) #display emoji
user_vehicle_choice = False #variable holding the boleean to keep the while loop
s3= print("""\n\nArriving to center of Gothan City by Arkham prison, I can detect some activities there master Bruce - Alfred said.
Batman - I can see Alfred, it looks like its the Riddler, I will aproach quickly.")
Alfred - Master bruce it looks like they captured Robin, and have him tied outside the prison, it looks like a trap.
Batman - Yeah I know, but there is only one way to fix the problem and it's me kicking Riddler back to prison.
Alfred - good luck master Bruce. Batman - good luck to them """,emojis.encode("\n:rage: "), emojis.encode("\n:collision: ")) #display story plus emojis
input("\n\nPress Enter to continue ...") #pausing game waiting for user enter
s4 = print("""\n\nRiddler - Well Robin, it looks like your parents forgot to pick you up from school.
You know what happen when things get forgetten, they end up in the lost and found aisle.
which end up in the garbage, after a while, we just accelering the proccess here, hahahahahhaha.
Robin - eat dust Riddler, Batman is coming and you will go back to Arkham prison, where you belong.
Batman - I'm already here Robin.
\nRiddler - ohh who lives in a cave, upside down and only comes out at night to play?
Batman - That one is easy, the only thing that you can't defeat, a bat.
Riddler - is that so, how is that?
\nBatman - cause I'm BATMAN.
\nRiddler - My fellow criminals attact the bat.
\n\nBatman fights agains all Riddler's men and beat all of them until there only him and Riddler.
\nBatman - now is only you and me Riddler are you ready to dance.
Riddler - my pleasure Batman, let's dance.""") #display story
print("\nyou have to help Batman fight riddler depending on the moves you use, you will be gaining or losing points of batman's health") #display message
print("To win you have to get Batman health to 150, but if Batman health gets to 0 you lose\n") #display message
input("\n\nPress Enter to begin the fight...") #pausing game waiting for user enter
print("\n\nBatman health bar is ", health) #display message to beging the fight
Batman_health = health # variable to hold universal variable & batman health
while Batman_health >= 1: #while loop for the fight
if Batman_health >= 1 and Batman_health <= 149: #if statement to break the loop if batman health decrease or increase
user_wrong_key = True #variable holding a boolean if user hit wrong key
while user_wrong_key == True: #while loop if user enter wrong kry
user_punch = input("\nBatman is throwing a punch left or right? ") # getting user input
if user_punch == "left": #if statement if user enter left to do something
print (emojis.encode("\n:facepunch: ")) #display punch emoji
Batman_health = Batman_health - left #batman health decrease
print("\nmiss Batman got punch") #display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
elif user_punch == "right": #elif statement if user input is right to do something
print (emojis.encode("\n:facepunch: ")) #display emoji
Batman_health = Batman_health + right #batman health increase
print("\nTake that riddler") # display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
else: #else statement
print("sorry wrong input, write left or right") #display message if user input wrong key
user_wrong_key = True # variable holding a boolean to keep the loop
if Batman_health >= 1 and Batman_health <= 149: #if statement to break the loop if batman health decrease or increase
user_wrong_key = True #variable holding a boolean if user hit wrong key
while user_wrong_key == True:#while loop if user enter wrong key
user_kick = input("\nBatman is throwing a kick left or right? ") #getting user input
if user_kick == "left": #if statement if user enter left to do something
print (emojis.encode("\n:feet: ")) #display kick emogi
Batman_health = Batman_health + left #batman health increase
print("\nRight on the money") #display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
elif user_kick == "right": #elif statement if user input is right to do something
print (emojis.encode("\n::feet: ")) #display emoji
Batman_health = Batman_health - right #batman health decrease
print("\nmiss Batman got kick,Riddler - guess what hurst Batman-") # display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
else: #else statement
print("sorry wrong input, write left or right") #display message if user input wrong key
user_wrong_key = True # variable holding a boolean to keep the loop
if Batman_health >= 1 and Batman_health <= 149: #if statement to break the loop if batman health decrease or increase
user_wrong_key = True #variable holding a boolean if user hit wrong key
while user_wrong_key == True: #while loop if user enter wrong key
user_punch2 = input("\nBatman is throwing another punch left or right? ") #getting user input
if user_punch2 == "left": #if statement if user enter left to do something
print (emojis.encode("\n:facepunch: ")) #display punch emoji
Batman_health = Batman_health + left #batman health increase
print("\nRight on the money") #display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
elif user_punch2 == "right": #elif statement if user input is right to do something
print (emojis.encode("\n:facepunch: ")) #display emoji
Batman_health = Batman_health - right #batman health decrease
print("\nmiss Batman got punch") # display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
else: #else statement
print("sorry wrong input, write left or right") #display message if user input wrong key
user_wrong_key = True #variable holding a boolean to keep the loop
if Batman_health >= 1 and Batman_health <= 149: #if statement to break the loop if batman health decrease or increase
user_wrong_key = True #variable holding a boolean if user hit wrong key
while user_wrong_key == True: #while loop if user enter wrong key
user_kick2 = input("\nBatman is throwing a kick left or right? ") #getting user input
if user_kick2 == "left": #if statement if user enter left to do something
print (emojis.encode("\n:feet: ")) #display kick emoji
Batman_health = Batman_health - left #batman health decrease
print("\nmiss Batman got kick") # display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
elif user_kick2 == "right": #elif statement if user input is right to do something
print (emojis.encode("\n:feet: ")) #display kick emoji
Batman_health = Batman_health + right #batman health increase
print("\nTake that") # display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
else:
print("sorry wrong input, write left or right")#display message if user input wrong key
user_wrong_key = True #variable holding a boolean to keep the loop
if Batman_health <= 0: # if statement if batman health goes to 0
print("sorry, Batman lost") #display message if batman lose
Batman_health = 0 #variable to break the fight loop
quit() #command to quit the game because batman lost the fight
elif Batman_health >= 150: #elif statement if batman gets to 150 to do something
print("Batman won") #display message, batman won
Batman_health = 0 #variable to break the fight loop
elif Batman_health >= 1 and Batman_health <= 149: #elif statement if batman helps win or loose keep going witht the program
pass
else: #else statement if user enter something wrong in the fight
print("sorry went wrong") #display message
s5 = print("""\n\nBatman - sorry Riddler your days of terror in the city are done.
Riddler- Batman this is not over. What is big, full of anger, full of poison, and want's to get his hands on you?
.............""") #display story 5
def storyline2(): #storyline 2 function
print(emojis.encode("\n:collision :")) #display emojis
s1 = print("""\n Things are collating, you hear heavy steps, everything is vibrating.
Boooommmmm, Booommmmmmmmm, Boooooooooooooommm.
Robin - oh no Batman look out.
Batman moved out of the way when I big rock almost smash him.
Batman - I knew it only a moster like you could do so much damage just by walking, BANE.
Bane - hahahahah, Batman you got your hand on the Riddler, but I'm going to finish what he started.
Bane - I'M GOING TO BREAK YOU IN HALF.
Batman - THe bigger the tree, the harder it fall, and you going down Bane.
Batman - Let's dance.\n""") #display story
print("\nyou have to help Batman fight Bane depending on the moves you use, you will be gaining or losing points of batman's health") #display message
print(" To win you have to get Batman health to 150, but if Batman health gets to 0 you lose\n") #display message
input("\n\nPress Enter to began the fight...") #pausing game waiting for user enter
print("\nBatman health bar is ", health) #display message to beging the fight
Batman_health = health # variable to hold universal variable & batman health
left = 15 # variable overwrite universal variable
right = 20 # variable overwrite universal variable
while Batman_health >= 1: #while loop for the fight
if Batman_health >= 1 and Batman_health <= 149: #if statement to break the loop if batman health decrease or increase
user_wrong_key = True #variable holding a boolean if user hit wrong key
while user_wrong_key == True: #while loop if user enter wrong kry
user_punch = input("\nBatman is throwing a punch left or right? ") # getting user input
if user_punch == "left": #if statement if user enter left to do something
print (emojis.encode("\n:facepunch: ")) #display punch emoji
Batman_health = Batman_health + left #batman health increase
print("\nohh Bane you never learn") #display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
elif user_punch == "right": #elif statement if user input is right to do something
print (emojis.encode("\n:facepunch: ")) #display emoji
Batman_health = Batman_health + right #batman health increase
print("\nTake that Bane") # display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
else: #else statement
print("sorry wrong input, write left or right") #display message if user input wrong key
user_wrong_key = True # variable holding a boolean to keep the loop
if Batman_health >= 1 and Batman_health <= 149: #if statement to break the loop if batman health decrease or increase
user_wrong_key = True #variable holding a boolean if user hit wrong key
while user_wrong_key == True:#while loop if user enter wrong key
user_kick = input("\nBatman is throwing a kick left or right? ") #getting user input
if user_kick == "left": #if statement if user enter left to do something
print (emojis.encode("\n:feet: ")) #display kick emogi
Batman_health = Batman_health - left #batman health decrease
print("\nBatman left foot got caught by bane and got punch back") #display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
elif user_kick == "right": #elif statement if user input is right to do something
print (emojis.encode("\n::feet: ")) #display emoji
Batman_health = Batman_health - right #batman health decrease
print("\nmiss Batman got thrown to a brick wall ,Bane - guess what, Batman you going to suffer") # display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
else: #else statement
print("sorry wrong input, write left or right") #display message if user input wrong key
user_wrong_key = True # variable holding a boolean to keep the loop
if Batman_health >= 1 and Batman_health <= 149: #if statement to break the loop if batman health decrease or increase
user_wrong_key = True #variable holding a boolean if user hit wrong key
while user_wrong_key == True: #while loop if user enter wrong key
user_punch2 = input("\nBatman is throwing another punch left or right? ") #getting user input
if user_punch2 == "left": #if statement if user enter left to do something
print (emojis.encode("\n:facepunch: ")) #display punch emoji
Batman_health = Batman_health + left #batman health increase
print("\nRight on the money") #display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
elif user_punch2 == "right": #elif statement if user input is right to do something
print (emojis.encode("\n:facepunch: ")) #display emoji
Batman_health = Batman_health - right #batman health decrease
print("\nmiss Batman got punch") # display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
else: #else statement
print("sorry wrong input, write left or right") #display message if user input wrong key
user_wrong_key = True #variable holding a boolean to keep the loop
if Batman_health >= 1 and Batman_health <= 149: #if statement to break the loop if batman health decrease or increase
user_wrong_key = True #variable holding a boolean if user hit wrong key
while user_wrong_key == True: #while loop if user enter wrong key
user_kick2 = input("\nBatman is throwing a kick left or right? ") #getting user input
if user_kick2 == "left": #if statement if user enter left to do something
print (emojis.encode("\n:feet: ")) #display kick emoji
Batman_health = Batman_health - left #batman health decrease
print("\nmiss Batman got kick") # display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
elif user_kick2 == "right": #elif statement if user input is right to do something
print (emojis.encode("\n:feet: ")) #display kick emoji
Batman_health = Batman_health + right #batman health increase
print("\nTake that, is the sound of justice") # display message
print("\nBatman health is = ", Batman_health) #display batman health
user_wrong_key = False #variable holding a boolean to break the loop
else:
print("sorry wrong input, write left or right")#display message if user input wrong key
user_wrong_key = True #variable holding a boolean to keep the loop
if Batman_health <= 0: # if statement if batman health goes to 0
print("sorry, Batman lost") #display message if batman lose
Batman_health = 0 #variable to break the fight loop
quit() #command to quit the game because batman lost the fight
elif Batman_health >= 150: #elif statement if batman gets to 150 to do something
print("Batman won") #display message, batman won
Batman_health = 0 #variable to break the fight loop
elif Batman_health >= 1 and Batman_health <= 149: #elif statement if batman helps win or loose keep going witht the program
pass
else: #else statement if user enter something wrong in the fight
print("sorry went wrong") #display message
s2 = print("""\n\nBatman got Bane & Riddler behind bars.
Robin was lose free headed back with Batman to the batcave.
Alfred - master Bruce I'm glad that you were able to put does criminal back were they belong.
Batman - Yeah we did some justice today, but is going to take more than that to clear the city of corruption.
Robin - Well, every villain should be afraid, because......
\n\nBatman - I'm Batman.""") #display bonus messages
print("\n\nThank you for playing Batman - Tales of the night") #display good bye message
def bonus(): #creating bonus function
print("\n\nBONUS\n") #display message
robin = ("Robin (character)") #variable holding string robin
user_bonus = input("Would you like to know info about Robin. yes or no? ") #getting user input if they want bonus information
if user_bonus == "yes" or user_bonus == "YES": #if statement if the user choose yes do something
bonus_search = wikipedia.page(robin) #variable holding wikipedia page
Robin = person() #variable is holding class properties
Robin.name ="Robin" #Robin variable holding a string
Robin.alias="Dick Grayson, Jason Todd, Tim Drake, & Damian Wayne" #Robin variable holding a string inherit properties from class
print("\n",Robin.name, "is: ", Robin.alias) #display variables and properties
print("\n",bonus_search.summary) #display user wikipedia search as a summary
print("\n\n Thank you for playing") #display goodbye message
input("\n\nPress Enter to quit the game...") #pausing game waiting for user enter
quit()
elif user_bonus == "no" or user_bonus == "NO": #elif statement if user choose no to do something
print ("\nYou missed some cool facts, Thank you for playing") #display message
quit() #command to quit the program
else: #else statement
quit() #command to quit the program
root.title("Batman - Tales of the Night")#creating tittle for the GUI Game
root.geometry("800x600+-1900+100") #sizing the main root
my_label = tk.Label(root, text="",bg = "light Gray", font=("couriel", 48)) #creating label for shuffle words
my_label.pack(pady=20) # positioning the label
global score #creating a global score
score = 0 #score hold the integer 0
score_label = tk.Label(root, text = "Your Score: " + str(score)) #creating the score label
score_label.place(x = 100, y = 100) #positioning the score label
def instruction(): #creating the instruction function
title_label = tk.Label(root, text = "Batman - Tales of the Night\nWord Jungle Game", font=("couriel", 25,"bold")) #creating a label for the tittle of the game with properties
ins_label = tk.Label(root,text = """Instructions\n
- A word will be randomly shuffle
- You will look at the word and try to figure out what it is
- Type the word that you think it is
- Press the answer button to check your answer
- If the word is correct, you will get a point, if the word is incorrect, you will lose a point
- When you score is up to 10 points, you will win the game
- When you score is in minus 10 points you will lose the game
- Press the hint button to get a hint
- Press the quit button to quit the game at anytime
Note: All words are batman related & all words start with a capital letter""",justify = "left") #creating label with instructions
title_label.pack() #displaying tittle
ins_label.pack() #displaying instructions
def shuffler(): #creating a shuffler function
hint_label.config(text='') # clearing the hint label
global hint_count #global variable for the hint count
hint_count = 0 #hint count is equal to 0
entry_answer.delete(0, tk.END) #Clearing entry box
answer_label.config(text='') #Clearing the answer label
# List of Batman words to shuffle
Batman_words = ["Batman","Bane", "Alfred", "Robin", "Riddler", "Batmobile","Batbelt", "Gotham","Bruce","Catwoman", "Batplane", "Joker","Gordon", "Batcave", "Justice", "Arkham prison"]
global word #global variable word
word = choice(Batman_words) #choose random words from the batman list
break_apart_word = list(word) #breaking apart the list of word
shuffle(break_apart_word) #shuffle the word chosen
global shuffled_word #global variable for shuffled word
shuffled_word = '' #creating space for the word
for letter in break_apart_word: #for loop to shuffled the variables
shuffled_word += letter # putting the back together into a word
my_label.config(text=shuffled_word) #display the shuffled word
def answer(): #Creating an answer Function
global score #global score
if word == entry_answer.get(): #if statement if the word is in the entry label get it
answer_label.config(text="Correct!!") #if the word is the right word display correct
score += 1 #score increase by 1 point
score_label.config(text = "Your Score: " + str(score)) #display score label
if score == 10: #if statement is score is equal to 10 do something
answer_label.config(text="Congratulations you Won the game",bg = "light blue", fg ="yellow",font=("couriel", 25,"bold")) #display label with properties & congratulation message
else: #else statement
answer_label.config(text="Incorrect!!")#if the word is the right word display correct
score -= 1 #score decrease by 1 point
score_label.config(text = "Your Score: " + str(score)) #display score label
if score == -10: #if statement is score is equal to -10 do something
answer_label.config(text="Sorry your lost", fg = "red",font=("couriel", 30,"bold")) #display label with properties & losing message
global hint_count #global variable for hint count
hint_count = 0 #hint count is holding a 0
def hint(count): #Creating a hint function
global hint_count #global variable for hint count
hint_count = count #hint count is holding count
word_length = len(word)# Getting the lenght of the chosen word
if count < word_length: # if statement to comperate count with the word lenght
hint_label.config(text=f'{hint_label["text"]} {word[count]}') # show the hint label
hint_count +=1 #hint count add letter
def game_quit(): #creating a quit function for the GUI
root.destroy() #terminaring the main root
entry_answer = tk.Entry(root, font=("couriel", 24)) #creating entry space
entry_answer.pack(pady=20) #displaying entry
button_frame = tk.Frame(root) #creating main frame
button_frame.pack(pady=20) #displaying main frame
answer_button = tk.Button(button_frame, text="Answer", command=answer) #creating the answer button, which it calls the answer function
answer_button.grid(row=0, column=0, padx=10) #displaying the answer button
my_button = tk.Button(button_frame, text="Choose Another Word", command=shuffler) #creating a a choose another word button
my_button.grid(row=0, column=1, padx=10) #displaying the choose another word
hint_button = tk.Button(button_frame, text="Hint", command=lambda: hint(hint_count)) #creating the hint button which will call the hint fucntion
hint_button.grid(row=0, column=2, padx=10) #displaying the hint button
answer_label = tk.Label(root, text='', font=("couriel", 18)) #creating the answer label
answer_label.pack(pady=20) #displaying the answer label
hint_label = tk.Label(root, text='', font=("couriel", 18))#creatind the hint label
hint_label.pack(pady=10) #displaying the hint label
quit_button = tk.Button(button_frame, text="Quit",fg = "red", command = game_quit) #creating the quit button
quit_button.grid(row=0, column=3, padx=10) #displaying the quit button
def x_game_menu(): #creating the extra game function menu
print("""\n\nThank you fo playing the first part of the game\n
Now you can either play the Word Jungle game or check the bonus\n
A - Word Jungle Game
B - Bonus
C - Quit the game
\nPlease pick A, B or C""") #displaying message with options for the user
user_choice = input("Which one you want to pick?: ") #getting user choices
if user_choice == "A" or user_choice == "a": #if statement if user choose A or a to do something
instruction()#calling instruction function
shuffler() #calling shuffler function
root.mainloop() #calling the main root
elif user_choice == "B" or user_choice == "b": #elif statement if user choose B or b to do something
bonus() #calling bonus function
elif user_choice == "C" or user_choice == "c": #elif statement if user choose B or b to do something
quit() #caling the quit method
else: #else statement if user put incorrect answer to do something
print("Sorry that is not right letter") #display message
x_game_menu() #calling the extra game function
def main(): #creating main function
prog_instruction() #calling the program introduction
input("\n\nPress Enter to start the program...") #pausing program waiting for user enter
welcome_message() # calling welcome function
user_info() #calling user info function
batman_info = Batman() #variable to hold the batman function
alfred_info = alfred() #variable to hold the alfred function
riddler_info = riddler() #variable to hold the riddler function
bane_info = bane() #variable to hold the bane function
characters_info(batman_info,alfred_info,riddler_info,bane_info) # calling characters info function passing a few variables
characters_id()
input("\n\nPress Enter to continue with the game...") #pausing game waiting for user enter
storyline() #calling story line function
input("\n\nPress Enter to continue with the game...") #pausing game waiting for user enter
storyline2()#calling storyline2 function
x_game_menu() #calling the extra game function
if name== "main":# If there is a main function then go to it
main()