Commit 3ddc013c by BellCodeEditor

save project

parent 05995422
Showing with 6 additions and 7 deletions
...@@ -4,13 +4,11 @@ class Hero: ...@@ -4,13 +4,11 @@ class Hero:
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def levelup(name): def levelup(self):
name.level+=1 self.level+=1
name.hp*=1.2 self.hp*=1.3
name.attack+=20 self.attack+=20
dream=Hero("dream",300,100) dream=Hero("dream",300,100)
dream.levelup()
levelup()
print(dream.hp) print(dream.hp)
print(dream.attack) print(dream.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