Commit e504e344 by BellCodeEditor

save project

parent 92eb2b38
Showing with 23 additions and 0 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
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