Commit 2fc9a47c by BellCodeEditor

save project

parent abe6bee2
Showing with 8 additions and 3 deletions
# 英雄角色类 # 英雄角色类
class Hero(object): class Hero(object):
def __init__(self, name): def __init__(self, name):
self.level = 1
self.hp = 250 self.hp = 250
self.attack = 40 self.attack = 40
self.name = name self.name = name
...@@ -16,4 +15,10 @@ class Hero(object): ...@@ -16,4 +15,10 @@ class Hero(object):
else: else:
info3=enemy.name+"阵亡,游戏结束" info3=enemy.name+"阵亡,游戏结束"
info=info1+info2+info3 info=info1+info2+info3
print(info) print(info)
\ No newline at end of file
class player(hero):
def__init__(self,name):
super().__init__(name):
self.hp=200
self.attack = 50
\ 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