Python Forum
My first 'GAME' It is a simple text adventure
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My first 'GAME' It is a simple text adventure
#1
Please by all means edit and modify this code and tell me what you think post links here or email them to me at: [REMOVED EMAIL]

Cut and paste this link:
[REMOVED LINK]
print('*******************MANIACAL----MANSION*********************')
print('           Coded and Maintained by Jack Spendiff'            )
print('Copyright 2017 by The Maniacal Masion Project ALL RIGHTS RESERVED')

print('you may not put capitol letters or any spaces in your inputs please it')
print('makes my job so much easier!Thank you for your co-operation')
print('NOTE: You must not use any caps or spaces copy exactly the options given')
print('NOTE:JUST REMOVE THE SPACES AND CAPITOL LETTERS')
print('If motel comes up always write gotomotel')


print('You Stand beside your destroyed car a ancient tree lying forcefully upon it')
print('Before you stands a huge old mansion-It has a maniacal presence')
print('You may:Enter or Walk to the motel')

Action=input()

if Action=='enter':
    print('The huge doors are bolted from the inside, it appears...')

print('Then you notice the iron door knocker...')
print('You may:Knock or go to the motel')

Action=input()

if Action=='gotomotel':
    print('You get a room and pass out')

if Action=='knock':
    print('The doors swing open and the friendly residents invite you in...')

if Action=='knock':
    print('You May:Go to the library or chat with the butler...')
    Action=input()

if Action=='gotomotel':
    print('You turn on the TV bowl of cereal in hand')
    print('The large Bagoom Mansion burned down last nuight all but the butler died.')
    print('You are strongly interested in the matter')
    print('Eventually you loose interest THE END...PLEASE CLOSE THE SCRIPT!!!')
if Action=='chatwiththebutler':
    print('He tells you that the gardener Mr.Green acts as though he is hiding something devious...')
    print('How So?you ask...')
    print('Well I caught a glance at his credit card statement and and he recently purchased highly flammable di-ethyl-ether-600 gallons!')
    print('If I were you Id get out of here! he says.')
    print('Lets do it!!-you say')
    print('The only other door is in the kitchen---he says')
    print('You barely get to out the gate on the oposite end of the lawn...')
    print('Not being an adventurer he is tired from the ordeal and wants to go to the motel but you want to report it to the police...')
if Action=='gotothelibrary':
    print('The French Doors are open you could leave or go talk to the butler')
print('You Can: leave')

Action==input()

if Action=="leave":
        print('You meet your end at the hands of MR.Green with a long skinny knife in your back...')
        


print('You can go to the motel or the police station')

Action=input()

if Action=='gotomotel':
          print('Though you did not cause the arrest of MR.Green at least your not in a 6FT pine box!')
          print('The Gardener Mr.Green is beleived to have set the the fire and has been apprehended the News reporter states.')
          print('This is supported by statements from the Butler and a guest at the time just before the crimec of the purchases by MR.Green of flammable substances...')

if Action=='gotothepolicestation':
          print('You have suceeded in foiling the plans of MR.Green!')
print('What is thine name?')
Name=input()
print("Congratulations"+" "+Name+"!")

    
Reply
#2
im just gonna put them in bullets 
  • capitalized variables are usually set aside for class names only.
  • your if structure should be an if elif structure, not if only 
  • you should use the format method instead
Quote:print("Congratulations"+" "+Name+"!")
print("congratulations {}!".format(Name))
or if using python3.6+
print(f"congratulations {Name}!")
Recommended Tutorials:
Reply
#3
Text adventures with an if/elif/else structure become more and more unwieldy as they grow, until they collapse. A much better structure is a loop that operates on data that defines the game. For an example of how to do this, check out the text adventures link in my signature below.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#4
I mean I get the unwieldiness of this whole idea and felt the unwieldiness grow as I programmed the darn thing!!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Lunar Lander Text Game hendry1 1 3,075 May-17-2020, 12:21 AM
Last Post: TomToad
  Text Adventure Game Nave5 1 2,222 Mar-30-2020, 05:06 AM
Last Post: SheeppOSU
  Simple Text Shop Simulator Feedback Dash 5 3,337 Apr-19-2019, 01:08 PM
Last Post: Dash
  Text base adventure game ForbNovak 12 7,302 Aug-29-2018, 03:11 PM
Last Post: Nwb
  Feedback on a test adventure? Panda 2 2,969 Jun-15-2018, 06:18 PM
Last Post: nilamo
  Christmas Text Adventure OriginalCal 3 5,501 Dec-13-2016, 06:06 PM
Last Post: OriginalCal

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020