Post: My first python game
06-23-2011, 02:10 AM #1
(adsbygoogle = window.adsbygoogle || []).push({}); This is a really simply python game I made.


    
def menu(list, question):
for entry in list:
print 1 + list.index(entry),
print ") " + entry

return input(question) - 1

items = ["pot plant","painting","vase","lampshade","shoe","door"]
keylocation = 2

keyfound = 0

loop = 1
print "Last night you went to sleep in the comfort of your own home."
print "Now you find yourself locked inside a room. You don't know how"
print "You got there, or what time it is. In the room you can see"
print len(items), "things:"
for x in items:
print x
print " "
print "the door is locked. Could there be a key somewhere?"
while loop == 1:
choice = menu(items, "what do you want to inspect?")
if choice == 0:
if choice == keylocation:
print "you found a small key in the pot plant!"
print " "
keyfound = 1
else:
print "you found nothing in the pot plant"
print " "
elif choice == 1:
if choice == keylocation:
print "you found a key behind the painting"
print " "
keyfound = 1
else:
print "you found nothing behind the painting"
print " "
elif choice == 2:
if choice == keylocation:
print "you found the key in the vase"
print " "
keyfound = 1
else:
print "you found nothing in the vase."
print " "
elif choice == 3:
if choice == keylocation:
print "you found the key in the lampshade"
print " "
keyfound = 1
else:
print "you found nothing in the lampshade"
print " "
elif choice == 4:
if choice == keylocation:
print "you found the key in a shoe"
print " "
keyfound = 1
else:
print "you found nothing in the shoe"
print " "
elif choice == 5:
if keyfound == 1:
loop = 0
print "you put the key in the door, turn it, and hear a click."
print " "

else:
print "The door is locked, you need to find the key."
print" "

print "light floods into the room as \
you open the door to your freedom."
(adsbygoogle = window.adsbygoogle || []).push({});
06-23-2011, 02:37 AM #2
schnzrs
Do a barrel roll!
Dude, use the code tag next time. Python scripts are near impossible to read without proper indentation.

The following 2 users say thank you to schnzrs for this useful post:

fightinillini94, XxprokillahxX
06-23-2011, 12:27 PM #3
Sorry I couldn't figure out how to at first.
07-22-2011, 07:35 AM #4
I wish I knew how to make a game :/
07-25-2011, 12:03 PM #5
Woof
...hmm
I don't really know python but I'm sure its good :y:
Well done & hope you do more and even better ones!
07-31-2011, 12:32 AM #6
Pichu
RIP PICHU.
Python looks weird too me, but then again all languages look weird until you learn them. Looks good though.

Copyright © 2026, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo