I may just be stupid, but I really can not understand it, I'm making a text based game and using different scenarios In order to emulate the character movement, I have used the following code:
import random north = ("There is a way to answer") south = ("south for one The way is. ") = East (" There is a way to the east. ") West = (" There is a way to the west. ") Nsew = [answer Print (Random. Chausa (NSE)) Print (Random. Chausa (NSE)) Print (Random. Chausa (NSE)) Print ("You find yourself in a woodland clearing.") Print (Random. (Nsew) Direction = Input ("How do you go?")
It should print four random objects from the list, which I do something like this I want to be able to:
if direction == ("answer"): Prin ("You decide to go north.")
But for every one with a if statement, so that the user will respond with the type "pre-program" you go east Fix "
thanks
< P> Hope it helps, it works in dragon 2.7, if you use 3 you can change my raw_input for input and put it around the print.
print ("you% s" has selected% path [index])
No comments:
Post a Comment