Commit 527f35f5 by BellCodeEditor

save project

parent d744c676
Showing with 7 additions and 5 deletions
...@@ -4,13 +4,15 @@ class Hero: ...@@ -4,13 +4,15 @@ class Hero:
self.name=name self.name=name
self.HP=HP self.HP=HP
self.attack=attack self.attack=attack
def upgrade(self):
self.HP=self.HP+100
self.level=self.level+100
self.attack=self.attack+1
kai=Hero('凯',5000,100) kai=Hero('凯',5000,100)
jialuo=Hero('伽罗',4000,200) jialuo=Hero('伽罗',4000,200)
def upgrade(): kai=Hero('凯',5000,100)
kai.HP=kai.HP+100 jialuo=Hero('伽罗',4000,200)
kai.level=kai.level+100 kai.upgrade()
kai.attack=kai.attack+1
upgrade()
print(kai.HP) print(kai.HP)
print(jialuo.HP) print(jialuo.HP)
......
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