Commit 8c8c9d4d by BellCodeEditor

save project

parent 56cd4a65
Showing with 10 additions and 13 deletions
......@@ -4,16 +4,13 @@ class Hero:
self.name = name
self.hp = hp
self.attack = attack
sunshangxiang = Hero("孙尚香",240,20)
daqiao = Hero("大乔",320,25)
xiaoqiao = Hero("小乔",300,24)
libai = Hero("李白",310,25)
hanxin = Hero("韩信",340,24)
def upgrade():
daqiao.leval = daqiao.leval+1
daqiao.hp = daqiao.hp+50
daqiao.attack = daqiao.attack+1
upgrade()
upgrade()
print("大乔的血量为:",daqiao.hp)
\ No newline at end of file
def upgrade(self):
self.leval = self.leval+1
self.hp = self.hp+50
self.attack = self.attack+1
daqiao = Hero("大乔",300,25)
daqiao.upgrade()
print("等级为:",daqiao.leval)
print("血量为:",daqiao.hp)
print("攻击力为:",daqiao.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