Advertisement
Guest User

rpgm

a guest
Feb 17th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. r1 = {"go left" : "You enter a room with enemy soldier that instantly charges you!" ,
  2. "go right" : "You enter a small armory. You see armor that looks like yours.",
  3. "take apple" : "Oh no! You touched the poisoned apple and died in horrible pain.",
  4. "status" : "You see an apple on round table and two doors. Doors on the right side are smaller than the ones on your left."}
  5. r2 = {"go left" : "You try to open the door but it's locked. This is not the way!",
  6. "take armor" : "You put on the armor. It fits perfectly!",
  7. "go back" : "You return back to the first room."}
  8. m1 = {"x" : "y"}
  9. inv = ['armor']
  10. alive = True
  11. current_room = r1
  12. cannotg = "You can\'t go there"
  13. cannoti = "You can\'t take that."
  14. raw_command = input("What do you want to do?")
  15. valid_cmd = True
  16.  
  17. def cmd(raw_command):
  18. commnd = raw_command.lower().split()
  19. return commnd
  20.  
  21. command = cmd(raw_command)
  22.  
  23. def room1(command):
  24. global alive
  25. global current_room
  26. global valid_cmd
  27. if command[0] == "take" and command[1] == "apple":
  28. print("You touched the poisoned apple and died.")
  29. alive = False
  30. elif command[0] == "take":
  31. print(cannoti)
  32. valid_cmd = False
  33. if command[0] == "go" and command[1] == "left":
  34. if 'armor' in inv:
  35. print("Good thing you went to the armory first! After heroic battle you emerge victorious!")
  36. current_room = m1
  37. else:
  38. print("Oh no, you don't have any fighting gear! Angry soldier killed you with a single swing.")
  39. alive = False
  40. elif command[0] == "go" and command[1] == "right":
  41. text1 = r1.get("go right")
  42. print(text1)
  43. current_room = r2
  44. elif command[0] == "go":
  45. print(cannotg)
  46. valid_cmd = False
  47. while alive == True and (current_room == r1 and valid_cmd == True):
  48. room1(command)
  49. else:
  50. valid_cmd = True
  51. pass
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement