axola

rpg code he

Apr 25th, 2024
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | Photo | 0 0
  1. #game
  2. #im not great at python but im trying to practice for my gcses lol!!
  3. import random
  4.  
  5. xp = 0
  6. lvl = 0
  7. levelNext = 5
  8.  
  9.  
  10. def var():
  11. global xp
  12. xp = 0
  13. global lvl
  14. lvl = 0
  15. global levelNext
  16. levelNext = 5
  17.  
  18.  
  19. def starter(): #displays basic char
  20. name = input("What is your name?")
  21. print("**********************************")
  22. print("**********************************")
  23. print("Your name is", name,"!!")
  24. print("You have 0 skill points currently.")
  25. print("You are currently unranked.")
  26. print("You have no weapons avaliable.")
  27. print("**********************************")
  28. print("**********************************")
  29.  
  30. def levels (): #level system?? when i call it it says the variables xp and lvl are not defined and im super confused!!
  31. while xp >= levelNext:
  32. lvl = lvl + 1
  33. xp = xp - levelNext
  34. levelNext = round(levelNext * 1.5)
  35. return lvl
  36.  
  37.  
  38. var()
  39. starter()
  40. print(" ")
  41. print(" ")
  42. print("Maybe if you train you could improve your skill..?")
  43. action = int(input("What would you like to do? 1. Train"))
  44. if action == 1:
  45. print(" ")
  46. print(" ")
  47. print("You do some push ups, but you can only do 5 before giving up.. You gained 5xp!")
  48. xp = xp + 5
  49. levels() #error here
  50. print(" ")
  51. print(" ")
  52. print("Well done, you have reached level",lvl,"!!")
Advertisement
Add Comment
Please, Sign In to add comment