Commit 660dff69 by BellCodeEditor

save project

parent 75d126d8
Showing with 21 additions and 3 deletions
import time
class Hero(): class Hero():
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.level=1 self.level=1
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
def upgrade():
print(yase.name+'升级!!')
yase.level+=1
yase.hp+=50
yase.attack+=5
yase=Hero('亚瑟',300,30) yase=Hero('亚瑟',300,30)
print('亚瑟的血量是',yase.hp) print(yase.name,'的等级为',yase.level)
print('亚瑟的血量是',yase.attack) print(yase.name,'的血量为',yase.hp)
\ No newline at end of file print(yase.name,'的攻击力为',yase.attack)
time.sleep(1)
upgrade()
print(yase.name,'的等级为',yase.level)
print(yase.name,'的血量为',yase.hp)
print(yase.name,'的攻击力为',yase.attack)
time.sleep(1)
upgrade()
print(yase.name,'的等级为',yase.level)
print(yase.name,'的血量为',yase.hp)
print(yase.name,'的攻击力为',yase.attack)
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