Commit a59efa2d by BellCodeEditor

save project

parent d09ad4cf
Showing with 11 additions and 10 deletions
...@@ -12,14 +12,15 @@ class Hero: ...@@ -12,14 +12,15 @@ class Hero:
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def frfgrde(): def frfgrde(self):
wukong.level=wukong.level+1 self.level=wukong.level+1
wukong.hp=wukong.hp+50 self.hp=wukong.hp+50
self.attack=wukong.attack+200
wukong = Hero("悟空",200,40) wukong = Hero("悟空",200,300)
yase = Hero("亚瑟",300,20) yase = Hero("亚瑟",300,20)
print(wukong.hp)
frfgrde() wukong.frfgrde()
frfgrde() print("悟空的初始血量值为:",wukong.hp)
print("升级两次后",wukong.hp) yase.frfgrde()
print(yase.attack) print("亚瑟的初始血量值为:",yase.hp)
\ No newline at end of file \ 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