Commit ace647d1 by BellCodeEditor

save project

parent f3f3ab8d
Showing with 6 additions and 6 deletions
...@@ -4,14 +4,14 @@ class Hero: ...@@ -4,14 +4,14 @@ class Hero:
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
self.name=name self.name=name
def upgrade(self):
self.level=self.level+1
self.hp=self.hp+50
self.attack=self.attack+4
sunge=Hero("sunge",300,20) sunge=Hero("sunge",300,20)
sunge.upgrade()
print(sunge.level,sunge.hp,sunge.attack) print(sunge.level,sunge.hp,sunge.attack)
def upgrade():
sunge.level=sunge.level+1
sunge.hp=sunge.hp+50
sunge.attack=sunge.attack+4
upgrade()
print(sunge.level,sunge.hp,sunge.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