Commit 40ea9dd6 by BellCodeEditor

save project

parent ad1a4d29
Showing with 11 additions and 5 deletions
...@@ -4,10 +4,15 @@ class Hero: ...@@ -4,10 +4,15 @@ class Hero:
self.name = name self.name = name
self.hp = hp self.hp = hp
self.attack = attack self.attack = attack
def upgrade():
ganjing.level = ganjing.level + 1
ganjing = Hero('赶紧',20,1000) ganjing = Hero('赶紧',20,1000)
shandiao = Hero('删掉',2000,1) shandiao = Hero('删掉',2000,1)
print('ganjing Hp:',ganjing.hp) #print('ganjing Hp:',ganjing.hp)
print('ganjing attack:',ganjing.attack) #print('ganjing attack:',ganjing.attack)
print('shandiao Hp:',shandiao.hp) #print('shandiao Hp:',shandiao.hp)
print('shandiao attack:',shandiao.attack) #print('shandiao attack:',shandiao.attack)
print('赶紧的初始血量为:',ganjing.level)
upgrade()
print('升级一次后的血量为:',ganjing.level)
\ 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