Commit c28a2893 by BellCodeEditor

save project

parent 1752bb84
Showing with 17 additions and 6 deletions
......@@ -17,14 +17,26 @@ class Hero(object):
m3=enemy.name+"已死亡"
print(m1+m2+m3)
yase = Hero("垭瑟")
#yase = Hero("垭瑟")
class Player(Hero):
def __init__(self,name):
def __init__(self,name,herotype):
super().__init__(name)
self.hp = 200
self.attack = 50
self.herotype = herotype
print("运行角色 OK,玩家"+self.name+" 已创建")
print("当前血量/攻击值:"+str(self.hp)+"/"+str(self.attack)+"\n"+"- "*15)
class Cpt(Player):
def __init__(self,name,herotype):
super().__init__(name,herotype)
self.herotype = herotype
print("运行程序 OK,电脑"+self.name+" 已生成")
print("设置血量/攻击值为 "+str(self.hp)+"/"+str(self.attack)+"\n"+"- "*15)
player=Player("后羿","射手")
computer=Cpt("垭瑟","None")
player=Player("后羿")
print("玩家血量值:",player.hp)
print("玩家血量值:",player.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