Advertisement
Kalidor_Vorlich

adventure.py

Dec 7th, 2024
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.64 KB | None | 0 0
  1. import json
  2. #from combat import mob
  3.  
  4.  
  5. #open json and load into 'data'
  6. with open('rooms.json', 'r') as f:
  7.   data = json.load(f)
  8.  
  9. current_room = "1" #check its assigned
  10. print(data[current_room]["description"])#check its assigned
  11.  
  12. current_room = "40" #change current room to 40
  13. print(data[current_room]["mob"]) #check its assigned
  14.  
  15.  
  16. def mob(data,current_room): # run function with data and room number attributes
  17.     mobname = data[current_room]["mob"]
  18.     mobskill = data[current_room]["skill"]
  19.     mobstamina = data[current_room]["stamina"]
  20.     print(mobname)
  21.     print(mobskill)
  22.     print(mobstamina)
  23.  
  24. mob(data,current_room)
  25.  
  26.  
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement