Commit 3adcaad2 by BellCodeEditor

save project

parent e7454e44
Showing with 8 additions and 9 deletions
...@@ -4,12 +4,12 @@ class Hero: ...@@ -4,12 +4,12 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def a(): def b(a):
yase.level=yase.level+1 a.level=a.level+1
yase.hp=yase.hp+50 a.hp=a.hp+50
yase.attack=yase.attack+4 a.attack=a.attack+4
yase=Hero('亚瑟',300,20) yase=Hero('亚瑟',300,20)
print("亚瑟的初始血量为:",yase.hp) yase.b()
a() print("等级:",yase.level)
a() print("血量:",yase.hp)
print("升级后的血量:",yase.hp) print("攻击力:",yase.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