Commit 850033d2 by BellCodeEditor

save project

parent 1cf9f5c8
Showing with 23 additions and 15 deletions
class Dog: # 狗类 class Hero(object):
def __init__(self): def __init__(self, name,hp):
self.footNum = 4 # 腿 self.level = 1
self.eyeNum = 2 # 眼睛 self.hp = hp
self.head = 1 # 头 self.attack = 40
self.earsNum = 2 # 耳朵 self.name = name
self.skin = "white"
def run(self): def combat(self,enemy):
print("狗狗飞快的跑起来") enemy.hp -= self.attack
if enemy.hp < 0:
print(enemy.name + '阵亡')
exit()
print(self.name , "对" , enemy.name ,'发起攻击',","'造成' ,str(self.attack) ,'点伤害,',enemy.name,"还剩下",str(enemy.hp),"格血")
class Player(Hero):
def __init__(self,name):
super().__init__(name,99)
self.attack = 55
class Husky(Dog): # 哈士奇类
def __init__(self):
??
coco = Husky()
print(coco.skin) yase = Hero("垭瑟",130)
\ No newline at end of file houyi= Player("后羿")
houyi.combat(yase)
yase.combat(houyi)
\ 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