Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("WELCOME")
- left_and_right = 0
- up_and_down = 0
- current_location =13
- class player_data(object):
- def __init__(self, name, role):
- self.health = 100
- self.attack = 5
- self.name = name
- self.role = role
- if role == "assasin":
- self.health -= 10
- self.attack += 3
- elif role == "defender":
- self.health += 25
- self.attack -= 1
- data = open(data_player).readline
- rma =player_data("romnell", "assasin")
- print(rma.health)
- print(rma.name)
- print(rma.attack)
- print(rma.role)
- while True:
- movement_direction = input("what direction would you like to go: ").lower()
- if movement_direction == "map": #prints map
- print(" "+"___ "*5+"\n"+
- "| 1 | 2 | 3 | 4 | 5 |\n"
- "|"+"___|"*5+"\n"+
- "| 6 | 7 | 8 | 9 |10 |\n"
- "|"+"___|"*5+"\n"+
- "|11 |12 |13 |14 |15 |\n"
- "|"+"___|"*5+"\n"+
- "|16 |17 |18 |19 |20 |\n"
- "|"+"___|"*5+"\n"+
- "|21 |22 |23 |24 |25 |\n"
- "|"+"___|"*5+"\nYou are currently on the Room",current_location)
- continue
- if movement_direction == "up":
- up_and_down+=1
- elif movement_direction == "down":
- up_and_down-=1
- elif movement_direction == "left":
- left_and_right-=1
- elif movement_direction == "right":
- left_and_right+=1
- else:
- print("Not a valid direction please enter(up, down, left, or right)")
- if left_and_right == 3:
- print("you cant go any further this direction")
- left_and_right = 2
- continue
- elif left_and_right == -3:
- print("you cant go any further this direction")
- left_and_right = -2
- continue
- elif up_and_down == -3:
- print("you cant go any further this direction")
- up_and_down = -2
- continue
- elif up_and_down == 3:
- print("you cant go any further this direction")
- up_and_down = 2
- continue
- #here are the code that determine what room the player is in
- if left_and_right == -2 and up_and_down == 2:
- current_location = 1
- elif left_and_right == -1 and up_and_down == 2:
- current_location = 2
- elif left_and_right == 0 and up_and_down == 2:
- current_location = 3
- elif left_and_right == 1 and up_and_down == 2:
- current_location = 4
- elif left_and_right == 2 and up_and_down == 2:
- current_location = 5
- elif left_and_right == -2 and up_and_down == 1:
- current_location = 6
- elif left_and_right == -1 and up_and_down == 1:
- current_location = 7
- elif left_and_right == 0 and up_and_down == 1:
- current_location = 8
- elif left_and_right == 1 and up_and_down == 1:
- current_location = 9
- elif left_and_right == 2 and up_and_down == 1:
- current_location = 10
- elif left_and_right == -2 and up_and_down == 0:
- current_location = 11
- elif left_and_right == -1 and up_and_down == 0:
- current_location = 12
- elif left_and_right == 0 and up_and_down == 0:
- current_location = 13
- elif left_and_right == 1 and up_and_down == 0:
- current_location = 14
- elif left_and_right == 2 and up_and_down == 0:
- current_location = 15
- elif left_and_right == -2 and up_and_down == -1:
- current_location = 16
- elif left_and_right == -1 and up_and_down == -1:
- current_location = 17
- elif left_and_right == 0 and up_and_down == -1:
- current_location = 18
- elif left_and_right == 1 and up_and_down == -1:
- current_location = 19
- elif left_and_right == 2 and up_and_down == -1:
- current_location = 20
- elif left_and_right == -2 and up_and_down == -2:
- current_location = 21
- elif left_and_right == -1 and up_and_down == -2:
- current_location = 22
- elif left_and_right == 0 and up_and_down == -2:
- current_location = 23
- elif left_and_right == 1 and up_and_down == -2:
- current_location = 24
- elif left_and_right == 2 and up_and_down == -2:
- current_location = 25
- print("You're currently in the room ", current_location, "\n")
Advertisement
Add Comment
Please, Sign In to add comment