Spaces:
Sleeping
Sleeping
File size: 345 Bytes
fdcbf65 |
1 2 3 4 5 6 7 8 9 10 11 12 |
# Implement an inventory system for the player to collect and use items.
class Item:
def __init__(self, name, effect):
self.name = name
self.effect = effect
def use_item(player, item):
if item.effect == "heal":
player.health += 20
print(f"{player.name} used {item.name}. Health is now {player.health}")
|