Commit b53a1665 by BellCodeEditor

save project

parent 07fc7ca2
Showing with 10 additions and 9 deletions
......@@ -5,13 +5,13 @@ class hero:
self.hp = hp
self.attack = attack
def upgrade():
ys.level=ys.level+1
ys.hp=ys.hp+50
ys.attack=ys+10
def upgrade(self):
self.level=ys.level+1
self.hp=ys.hp+50
self.attack=ys+10
ys = hero("ys",300,20)
print("ys的初始血量为:"ys.hp)
upgarde()
upgarde()
print("ys升级二次后血量为:"ys.hp)
hi = hero("hi",240,25)
hi.upgrade()
print("等级",hi.level)
print("血量",hi.hp)
print("攻击",hi.attack)
\ 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