Commit 5062d2dd by BellCodeEditor

save project

parent e504e344
Showing with 8 additions and 23 deletions
class Hero:
def __init__(self,name):
self.hp=200
self.atk=50
self.name=name
self.level=1
def kill(self,sb):
sb.hp-=self.atk
if sb.hp>0:
print(sb+"还剩"+sb.hp)
else:
print(sb+"去世了")
class Player(Hero):
def __init__(self,name,p):
super().__init__(name)
self.hp=400
self.atk=20
self.p=p
print(self.name+"是"+self.p)
print(str(self.level)+" "+str(self.hp)+" "+str(self.atk))
yase=Hero("yase")
houyi=Player("houyi","bow")
\ No newline at end of file
class hero:
def __init__(slef):
slef.level=1
slef.hp=300
slef.attack=20
yase=hero()
print(yase.hp)
\ 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