Commit becd35fd by BellCodeEditor

save project

parent c4f2f49c
Showing with 16 additions and 5 deletions
...@@ -5,8 +5,18 @@ class Hero: ...@@ -5,8 +5,18 @@ class Hero:
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
yase = Hero("亚瑟",1000,2000) #yase = Hero("亚瑟",1000,200)
houyi = Hero("后裔",550,100) #houyi = Hero("后裔",550,100)
print("输出亚瑟的血量:"yase.hp) #print("亚瑟血量:",yase.hp)
print("输出后裔的血量:"houyi.hp) #print("后裔血量",houyi.hp)
def upgrade(self):
self.level = self.level+1
self.hp = self.hp+200
self.attack = self.attack+100
yase = Hero("亚瑟",1000,200)
yase.upgrade()
print("亚瑟等级:",yase.level)
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