Commit 85b0ef4c by BellCodeEditor

save project

parent 0ee5baf7
Showing with 10 additions and 12 deletions
......@@ -4,15 +4,13 @@ class Hero:
self.name=name
self.hp=hp
self.attack=attack
yuange=Hero('yuange',5799,190)
lixin=Hero('lixin',9303,137)
print(yuange.attack)
print(lixin.attack)
def upgrade():
lixin.level+=1
lixin.hp+=100
lixin.attack+=30
def upgrade(self):
self.level+=1
self.hp+=100
self.attack+=30
upgrade()
upgrade()
print(lixin.attack)
\ No newline at end of file
lixin=Hero("李信",2000,40)
lixin.upgrade()
print("等级为:",lixin.attack)
print("血量为:",lixin.hp)
print("攻击力为:",lixin.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