Commit 98c7976e by BellCodeEditor

save project

parent 8427c228
Showing with 20 additions and 25 deletions
class Hero:
def __init__(self1):
#属性
self1.name='亚瑟'
self1.level = 1
self1.hp=300
self1.attack=20
def __init__(self,n,h,a):
self.level=1
self.name=n
self.hp=h
self.attack=a
#定义亚瑟
亚瑟=Hero('亚瑟',340,80)
#定义赵云
赵云=Hero('赵云',240,120)
#定义后羿
后羿=Hero('后羿',240,110)
#定义张飞
张飞=Hero('张飞',320,90)
#方法
def __init__(self2):
self2.level1=0
self2.name1="赵云"
self2.hp1=300
self2.attack1=100
def move():
pass
def speak():
pass
赵云 = Hero()
print(赵云.level1)
print(赵云.hp1)
print(赵云.attack1)
print(亚瑟.name,"\n","的血量是:",亚瑟.hp,"\n","攻击力是:",亚瑟.attack,"\n","等级是:",亚瑟.level)
亚瑟 = Hero()
print(亚瑟.level)
print(亚瑟.hp)
print(亚瑟.attack)
\ No newline at end of file
print(赵云.name,"\n","的量是:",赵云.hp,"\n","攻击力是:",赵云.attack,"\n","等级是:",赵云.level)
print(后羿.name,"\n","的量是:",后羿.hp,"\n","攻击力是:",后羿.attack,"\n","等级是:",后羿.level)
print(张飞.name,"\n","的量是:",张飞.hp,"\n","攻击力是:",张飞.attack,"\n","等级是:",张飞.level)
\ 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