Commit 46717cbf by BellCodeEditor

auto save

parent b8fe2f48
Showing with 23 additions and 6 deletions
class Hero:
def __init__(self):
self.level=1
self.hp=300
self.attack=100
yase=Hero
print(亚射的血量:self.hp)
def __init__(self,name,hp,attack):
self.level = 1
self.name = name
self.hp = hp
self.attack = attack
def upgrade(self):
self.level = self.level + 1
self.hp = self.hp + 50
self.attack = self.attack + 50
yase = Hero("亚瑟",100,20)
him = Hero("他",100,20)
boy = Hero("男孩",100,20)
yase.upgrade()
him.upgrade()
boy.upgrade()
print("亚瑟的血量:",yase.hp)
print("他的血量:",him.hp)
print("男孩的血量:",boy.hp)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment