Commit 489fdf62 by BellCodeEditor

save project

parent 54ecb4ff
Showing with 10 additions and 4 deletions
class Hero: class Hero:
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack,level):
self.level=1 self.level=level
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def shengji():
self.hp=yase.hp+50
self.attack=yase.attack+5
self.level=yase.level+1
yase=Hero("亚瑟",300,20) yase=Hero("亚瑟",300,20,1)
dijia=Hero("迪迦",200,30) dijia=Hero("迪迦",200,30,1)
yase.shengji()
print(yase.name+str(yase.hp)) print(yase.name+str(yase.hp))
print(dijia.name+str(yase.hp)) print(dijia.name+str(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