Commit 830f6136 by BellCodeEditor

save project

parent 3c1f898a
Showing with 17 additions and 7 deletions
class Hero:
def __init__(self):
def __init__(self,name,hp,attack):
self.level=999
self.hp=825
self.attack=500
wyh=Hero()
print("wyh的血量为:",wyh.hp)
print("wyh的攻击力为:",wyh.attack)
\ No newline at end of file
self.name=name
self.hp=hp
self.attack=attack
def upgrade(self):
wyh.level+=1
wyh.hp+=50
wyh.attack+=4
wyh=Hero('wyh',500,80)
wyh.upgrade()
print("wyh的血量为",wyh.hp)
print("wyh的血量为",wyh.attack)
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