Commit ac94219d by BellCodeEditor

save project

parent 3e9dfd25
Showing with 10 additions and 5 deletions
......@@ -3,7 +3,12 @@ class Hero:
self.level = 1
self.hp = 300
self.attack = 20
anbei = Hero()
print("安倍的血量为:",anbei.hp)
print("安倍的攻击力为:",anbei.attack)
sang=Hero('')
\ No newline at end of file
def upgrade():
anbei,level = anbei.level+1
anbei.hp=anbei.hp+30
anbei.attack = anbei.attack+1
anbei = Hero(安倍小三,30,10)
print("安倍的初始血量为:",anbei.hp)
upgrade()
upgrade()
print("安倍升级后的血量为:"anbei.hp)
\ 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