Commit 98c7976e by BellCodeEditor

save project

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