Commit 20aa9324 by BellCodeEditor

save project

parent 4c297764
Showing with 6 additions and 3 deletions
......@@ -17,13 +17,15 @@ class Hero:
info=info1+info2+info3
print(info)
class Player(Hero):
def __init__(self,name):
def __init__(self,name,hero_type):
super().__init__(name)
self.hp=200
self.attack=50
self.hero_type=hero_type
print('恭喜你成功创造角色:'+self.name+'他的英雄类型为:'+self.hero_type)
print('他的属性为等级:',self.level,'血量:',self.hp,'攻击力:',self.attack)
yase=Hero('亚瑟')
houyi=Player('后羿')
houyi=Player('后羿','射手')
yase.combat(houyi)
print(houyi.hp)
print(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