Commit aa5f4b4e by BellCodeEditor

save project

parent d6c81a0f
Showing with 45 additions and 0 deletions
import time
class hero:
def __init__(self,name,hp,attack):
self.level = 1
self.name = name
self.hp = hp
self.attack = attack
yase = hero('亚瑟',300,20) #王者荣耀坑钱
CT = hero('反恐精英',100,1000) #AWP一枪毙命
print('名称:'+str(yase.name))
time.sleep(3)
print('等级:'+str(yase.level))
print('血量:'+str(yase.hp))
print('攻击力:'+str(yase.attack))
time.sleep(3)
print('-'*20)
time.sleep(3)
print('名称:'+str(CT.name))
print('等级:'+str(CT.level))
print('血量:'+str(CT.hp))
print('攻击力:'+str(CT.attack))
time.sleep(3)
print('-'*20)
def levelup(self): #反恐精英买了头甲
self.level = self.level + 1
self.hp = self.hp + 100
self.attack = self.attack + 100
levelup(yase)
levelup(CT)
print('升级装备和等级后')
time.sleep(3)
print('-'*20)
print('名称:'+str(yase.name))
print('等级:'+str(yase.level))
print('血量:'+str(yase.hp))
print('攻击力:'+str(yase.attack))
time.sleep(3)
print('-'*20)
time.sleep(3)
print('名称:'+str(CT.name))
print('等级:'+str(CT.level))
print('血量:'+str(CT.hp))
print('攻击力:'+str(CT.attack))
print('-'*20)
\ 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