Commit fa6d1032 by BellCodeEditor

save project

parent f06362b8
Showing with 10 additions and 0 deletions
...@@ -4,8 +4,18 @@ class Hero: ...@@ -4,8 +4,18 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
wo=Hero("我",1000,500) wo=Hero("我",1000,500)
ni=Hero("你",100,12) ni=Hero("你",100,12)
def upgrade():
wo.level+=1
wo.hp+=50
wo.attack+=10
upgrade()
upgrade()
print("我的血量为:",wo.hp) print("我的血量为:",wo.hp)
print("我的攻击力为:",wo.attack) print("我的攻击力为:",wo.attack)
print("你的血量为:",ni.hp) print("你的血量为:",ni.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