Commit 1665446f by BellCodeEditor

save project

parent 7cbc4e6e
Showing with 8 additions and 14 deletions
class Hero:
def __init__(self):
self.level=1
self.hp=300
self.attack=20
yase=Hero()
print("亚瑟的等级为",yase.level)
\ No newline at end of file
class Hero:
def __init__(self,name,hp,attack):
self.name=name
self.hp=hp
self.attack=attack
def upgrade(self):
self.hp=self.hp+50
self.attack=self.attack+4
houyi=Hero("后羿",500,50)
houyi.upgrade()
print("后羿的血量",houyi.hp)
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