Commit 360a2169 by BellCodeEditor

save project

parent 105f85b3
Showing with 13 additions and 4 deletions
...@@ -4,8 +4,16 @@ class Hero: ...@@ -4,8 +4,16 @@ class Hero:
self.name = name self.name = name
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
yase = Hero("后羿",40000,50000) def upgrade(self):
houyi = Hero("妲己",40000,1) self.level=self.level+1
print("后羿的血量为:",yase.hp) self.hp=self.hp + 50
print("妲己的血量为:",yase.hp) self.attack=self.attack + 4
houyi = Hero("后羿",40000,50000)
houyi.upgrade()
print("等级力:",houyi.level)
print("血量为:",houyi.hp)
print("攻击力: ",houyi.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