Need help with Python text game

Started by
0 comments, last by dead1ock 14 years, 5 months ago
I am new to making games so I think I will start out small. At first I thought I would make a game like Zelda using pygame, but thats to much work for me (now). So I will now start out smaller. My plan is to tell a detective story in a text based game. The player starts out by typing in their name, and then the story starts, and all that works fine, but now we come to my first problem. I want the player to have an option between 2 things, example "go to the crime seen" or "Talk to the victims wife", but I don't know how to give the player the option of choosing one or the other, and I also want to avoid the player typing in "The murderer is X" in the beginning of the game. Any help would be appreciated.
Advertisement
Look up python if/else statements on the documentation site. What you will want to do is show the options to the player as a number, i.e.

Where would you like to go?1) The crime scene.2) The fair.3) Back to the office.


Then get input from the player using the "raw_input" function. He or she will have to input the number that corresponds to where they want to go.

You would then compare what you got from the "raw_input" function with the range of possible numbers. If it is in-rage, then go the the next function in your program that is the result of the users choice. If not, prompt the user that his/hers input was invalid.

This should get you started,
http://www.penzilla.net/tutorials/python/consoleio/

This topic is closed to new replies.

Advertisement