Guest User

txt based rpg

a guest
Jan 14th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.64 KB | None | 0 0
  1. print("WELCOME")
  2. left_and_right = 0
  3. up_and_down = 0
  4. current_location =13
  5. class player_data(object):
  6.     def __init__(self, name, role):
  7.         self.health = 100
  8.         self.attack = 5
  9.         self.name = name
  10.         self.role = role
  11.         if role == "assasin":
  12.             self.health -= 10
  13.             self.attack += 3
  14.         elif role == "defender":
  15.             self.health += 25
  16.             self.attack -= 1
  17. data = open(data_player).readline
  18. rma =player_data("romnell", "assasin")
  19. print(rma.health)
  20. print(rma.name)
  21. print(rma.attack)
  22. print(rma.role)
  23. while True:
  24.     movement_direction = input("what direction would you like to go: ").lower()
  25.    
  26.     if movement_direction == "map": #prints map
  27.         print(" "+"___ "*5+"\n"+
  28.             "| 1 | 2 | 3 | 4 | 5 |\n"
  29.             "|"+"___|"*5+"\n"+
  30.             "| 6 | 7 | 8 | 9 |10 |\n"
  31.             "|"+"___|"*5+"\n"+
  32.             "|11 |12 |13 |14 |15 |\n"
  33.             "|"+"___|"*5+"\n"+
  34.             "|16 |17 |18 |19 |20 |\n"
  35.             "|"+"___|"*5+"\n"+
  36.             "|21 |22 |23 |24 |25 |\n"
  37.             "|"+"___|"*5+"\nYou are currently on the Room",current_location)
  38.         continue
  39.     if movement_direction == "up":  
  40.         up_and_down+=1
  41.     elif movement_direction == "down":
  42.         up_and_down-=1
  43.     elif movement_direction == "left":
  44.         left_and_right-=1
  45.     elif movement_direction == "right":
  46.         left_and_right+=1      
  47.     else:
  48.         print("Not a valid direction please enter(up, down, left, or right)")
  49.     if left_and_right == 3:
  50.         print("you cant go any further this direction")
  51.         left_and_right = 2
  52.         continue
  53.     elif left_and_right == -3:
  54.         print("you cant go any further this direction")
  55.         left_and_right = -2
  56.         continue
  57.     elif up_and_down == -3:
  58.         print("you cant go any further this direction")
  59.         up_and_down = -2
  60.         continue
  61.     elif up_and_down == 3:
  62.         print("you cant go any further this direction")
  63.         up_and_down = 2
  64.         continue
  65. #here are the code that determine what room the player is in
  66.     if left_and_right == -2 and up_and_down == 2:
  67.         current_location = 1
  68.     elif left_and_right == -1 and up_and_down == 2:
  69.         current_location = 2
  70.     elif left_and_right == 0 and up_and_down == 2:
  71.         current_location = 3
  72.     elif left_and_right == 1 and up_and_down == 2:
  73.         current_location = 4
  74.     elif left_and_right == 2 and up_and_down == 2:
  75.         current_location = 5
  76.     elif left_and_right == -2 and up_and_down == 1:
  77.         current_location = 6
  78.     elif left_and_right == -1 and up_and_down == 1:
  79.         current_location = 7
  80.     elif left_and_right == 0 and up_and_down == 1:
  81.         current_location = 8
  82.     elif left_and_right == 1 and up_and_down == 1:
  83.         current_location = 9
  84.     elif left_and_right == 2 and up_and_down == 1:
  85.         current_location = 10
  86.     elif left_and_right == -2 and up_and_down == 0:
  87.         current_location = 11
  88.     elif left_and_right == -1 and up_and_down == 0:
  89.         current_location = 12
  90.     elif left_and_right == 0 and up_and_down == 0:
  91.         current_location = 13
  92.     elif left_and_right == 1 and up_and_down == 0:
  93.         current_location = 14
  94.     elif left_and_right == 2 and up_and_down == 0:
  95.         current_location = 15
  96.     elif left_and_right == -2 and up_and_down == -1:
  97.         current_location = 16
  98.     elif left_and_right == -1 and up_and_down == -1:
  99.         current_location = 17
  100.     elif left_and_right == 0 and up_and_down == -1:
  101.         current_location = 18
  102.     elif left_and_right == 1 and up_and_down == -1:
  103.         current_location = 19
  104.     elif left_and_right == 2 and up_and_down == -1:
  105.         current_location = 20
  106.     elif left_and_right == -2 and up_and_down == -2:
  107.         current_location = 21
  108.     elif left_and_right == -1 and up_and_down == -2:
  109.         current_location = 22
  110.     elif left_and_right == 0 and up_and_down == -2:
  111.         current_location = 23
  112.     elif left_and_right == 1 and up_and_down == -2:
  113.         current_location = 24
  114.     elif left_and_right == 2 and up_and_down == -2:
  115.         current_location = 25
  116.     print("You're currently in the room ", current_location, "\n")
Advertisement
Add Comment
Please, Sign In to add comment