Commit cd5d68cd by BellCodeEditor

auto save

parent bbb04678
Showing with 18 additions and 6 deletions
class Hero:
def __init__(self):
def __init__(self,name,hp,attack):
self.level=1
self.hp=300
self.attack=20
self.name=name
self.hp=hp
self.attack=attack
def upgrate(self):
self.level=self.level
self.hp=self.hp+100
self.attack=self.attack+10
YaSe=Hero("YaSe",300,20)
HouYi=Hero("HouYi",240,23)
YaSe.upgrate()
H
YaSe=Hero()
print(Yase.level)
print(Yase.hp)
\ No newline at end of file
print(Yase.hp)
print(HouYi level)
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