Advertisement
Guest User

Untitled

a guest
Nov 21st, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. import random
  2.  
  3. # This function adds two numbers
  4. def add(x, y):
  5. return x + y
  6.  
  7. # This function subtracts two numbers
  8. def subtract(x, y):
  9. return x - y
  10.  
  11. player_health = 60
  12. enemy_health = 50
  13.  
  14. print("Current Player Health:",player_health)
  15. print("Current Enemy Health:",enemy_health)
  16.  
  17. #set of abilities that a player could user:
  18.  
  19. punch = random.randint(10,20)
  20. kick = random.randint(5,10)
  21. slap = random.randint(15,25)
  22.  
  23. print("\n1. Punch")
  24. print("2. Kick")
  25. print("3. Slap")
  26.  
  27. decision = input("\nWhat ability would you like to use?")
  28.  
  29. if decision == "1":
  30. print("You hit the enemy for:" ,punch)
  31. print("The current health of the enemy is: " ,subtract(enemy_health,punch))
  32.  
  33. elif decision == "2":
  34. print("You hit the enemy for:" ,kick)
  35. print("The current health of the enemy is: " ,subtract(enemy_health,kick))
  36.  
  37. elif decision == "3":
  38. print("You hit the enemy for:" ,slap)
  39. print("The current health of the enemy is: " ,subtract(enemy_health,slap))
  40.  
  41. else:
  42. print("\nThat is not a valid move. Please try again.")
  43.  
  44. #how do I go about automating the enemy to attack the player?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement