Commit 311a5018 by BellCodeEditor

save project

parent 5f43c146
Showing with 20 additions and 11 deletions
...@@ -4,15 +4,24 @@ class Hero: ...@@ -4,15 +4,24 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
yase=Hero('亚瑟',3648,224) def upgrade(self):
houyi=Hero('后羿',2674,276) self.level=self.level+1
print(yase.hp) self.hp=self.hp*1.2
print(houyi.hp) self.attack=self.attack*1.2
def upgrade(): yase=Hero('亚瑟',3600,224)
yase.level=yase.level+1 houyi=Hero('后羿',2600,276)
yase.hp=yase.hp+500 print('亚瑟的等级是',yase.level)
yase.attack=yase.attack+80 print('亚瑟的血量是',yase.hp)
upgrade() print('亚瑟的攻击是',yase.attack)
print(yase.hp) print('后羿的等级是',houyi.level)
print(houyi.hp) print('后羿的血量是',houyi.hp)
print('后羿的攻击是',houyi.attack)
yase.upgrade()
houyi.upgrade()
print('亚瑟的等级是',yase.level)
print('亚瑟的血量是',yase.hp)
print('亚瑟的攻击是',yase.attack)
print('后羿的等级是',houyi.level)
print('后羿的血量是',houyi.hp)
print('后羿的攻击是',houyi.attack)
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