Commit 50f5333e by BellCodeEditor

save project

parent b2965f72
Showing with 8 additions and 5 deletions
......@@ -5,11 +5,13 @@ class Hero:
self.hp = hp
self.attack = attack
def upgrade():
jeige.level = jeige.level+1
jeige.hp = jeige.hp+50
jeige.attack = jeige.attack+10
def upgrade(self):
self.level = self.level+1
self.hp = self.hp+50
self.attack = self.attack+10
jeige = Hero("杰哥",300,10)
upgrade()
laoba = Hero("老八",200,30)
jeige.upgrade()
laoba.upgrade()
print("杰哥的血量:",jeige.hp)
\ 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