Commit 76a47570 by BellCodeEditor

save project

parent 0f0fa545
Showing with 34 additions and 19 deletions
class Dog: # 狗类 class Hero:
def __init__(self): def _init_(self,hp,attack,name):
self.footNum = 4 # 腿 self.leve1=1
self.eyeNum = 2 # 眼睛 self.hp=hp
self.head = 1 # 头 self.attack=attack
self.earsNum = 2 # 耳朵 self.name=name
self.skin = "white" #def upgrade(self):
# self.leve1=self.leve1+1
def run(self): # self.hp=self.hp+50
print("狗狗飞快的跑起来") # self.attack=attack+4
def combat(self,enemy):
if enemy.hp>0
class Husky(Dog): # 哈士奇类 enemy.hp-= self.attack
def __init__(self): info1=self.name+"对"+enemy.name+"发起进攻,"
?? info2="造成"+str(self.attack)+"点伤害,"
info3=enemy.name+"剩余血量"+str(enemy.hp)+"点"
coco = Husky() info=info1+info2+info3
print(coco.skin) print(into)
\ No newline at end of file else:
info3=enemy.name+"阵亡,游戏结束"
info=info1+info2+info3
print(into)
exit()
class player(hero):
def _init_(name)
self.hp=200
self.attack=50
self.hero_type=hero_type
houyi=player("后羿""射手")
yase=hero("亚瑟")
houyi=player("后羿")
houyicombat(yase)
\ 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