Commit b5b05e7c by BellCodeEditor

save project

parent 7716f532
Showing with 18 additions and 5 deletions
class Hero:
def __init__(self):
def __init__(self,name,hp,attack):
self.leve=1
self.hp=300
self.attack=20
yase=Hero()
print(yase.hp)
self.hp=hp
self.attack=attack
self.name=name
def upgrade(self):
self.level = yase.level+1
self.hp=yase.hp+500
self.attack=yase.attack+50
yase=Hero("亚瑟",5000,200)
houyi=Hero("后裔",3000,350)
yase.upgrade()
houyi.upgrade()
print("亚瑟的血量是",yase.hp)
print("后裔的血量是",yase.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