Commit fa91dcc7 by BellCodeEditor

auto save

parent 9a581ef4
Showing with 22 additions and 15 deletions
# 英雄角色类
class Hero(object):
def __init__(self, name):
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
def combat(): # 攻击
???
yase = Hero("垭瑟")
houyi= Hero("后羿")
yase.combat(houyi)
\ No newline at end of file
class hero:
def __init__(self,name,level,hp,attack):
self.level=level
self.hp=hp
self.attack=attack
self.name=name
LuBan=hero('鲁班',1,2500,230)
HouYi=hero('后羿',1,3000,180)
def combat(self):
print(LuBan.name)
print(LuBan.level)
print(LuBan.hp)
print(LuBan.attack)
print(LuBan.name)
print(LuBan.level)
print(LuBan.hp)
print(LuBan.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