Commit 53b0264f by BellCodeEditor

save project

parent 22354288
Showing with 18 additions and 0 deletions
class Hero:
def __init__(self,name,HP,MP,attack):
self.level=1
self.name=name
self.HP = HP
self.MP = MP
self.attack = attack
def level(self):
self.level=self.level+1
self.HP = self.HP+50
self.MP = self.MP+30
self.attack = self.attack+10
yase = Hero("亚瑟",300,200,20)
houyi = Hero("后羿",250,300,30)
yase.level()
print(yase.HP)
print(houyi.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