Commit 8cf6cdeb by BellCodeEditor

save project

parent 42ea2805
Showing with 9 additions and 9 deletions
......@@ -5,13 +5,13 @@ class Hero:
self.hp = hp
self.attack = attack
def upgrade():
xiao.level=xiao.level+10
xiao.hp=xiao.hp+650
xiao.attack=xiao.attack+780
def upgrade(self):
self.level=self.level+10
self.hp=self.hp+650
self.attack=self.attack+780
xiao = Hero("魈",300,20)
print(xiao.hp)
upgrade()
upgrade()
print(xiao.hp)
\ No newline at end of file
xiao.upgrade()
print("等级为:",xiao.level)
print("血量为:",xiao.hp)
print("攻击为:",xiao.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