Commit eb11efd7 by BellCodeEditor

save project

parent c0dc5df9
Showing with 13 additions and 14 deletions
class Sb:
def __init__(hero,name,hp,attack):
hero.hp=hp
name=name
hero.level=1
hero.attack=attack
yase=Sb("亚瑟",900,30)
print(yase.name)
def upgrade():
yase.level += 1
if yase.level==yase.level+1
yase.hp += 50
yase.attack += 4
def
\ No newline at end of file
def __init__(self,name,hp,attack):
self.hp=hp
self.name=name
self.level=1
self.attack=attack
def upgrade(self):
self.level += 1
self.hp =self.hp + 150
self.attack = self.attack + 10
yase=Sb("亚瑟",300,20)
yase.upgrade()
print(yase.hp)
print(yase.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