Commit 99415d6b by BellCodeEditor

save project

parent ac2f8481
Showing with 12 additions and 4 deletions
class Hero(): class Hero():
def __init__(self,name,hp,attack): def __init__(self,name,hp,attack):
self.level=1
self.name=name self.name=name
self.hp=hp self.hp=hp
self.attack=attack self.attack=attack
yase=Hero("亚瑟",300,20) yase=Hero("亚瑟",300,20)
houyi=Hero("后羿",250,23) houyi=Hero("后羿",250,23)
lubanqihao=Hero("鲁班七号",100,150) lubanqihao=Hero("鲁班七号",100,150)
print("亚瑟的攻击"yase.attack) print("亚瑟的攻击",yase.attack,"血量:",yase.hp)
print("后羿的攻击"houyi.attack) print("后羿的攻击:",houyi.attack,"血量:",houyi.hp)
print("鲁班七号的攻击"lubanqihao.attack) print("鲁班七号的攻击",lubanqihao.attack,"血量:",lubanqihao.hp)
\ No newline at end of file #def upgrade():
# yase.level=level+1
# yase.hp=hp+50
# yase.attack=attack+5
#upgrade()
#upgrade()
#print("亚瑟2级血量为",yase.hp)
\ 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