Commit ac94219d by BellCodeEditor

save project

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