Commit 2d719325 by BellCodeEditor

save project

parent 008706d6
Showing with 36 additions and 0 deletions
class Cat:
def __init__(self)
self.footNum = 4
self.eyeNum = 2
self.head = 1
self.earsNum = 2
self.skin = "white"
def run(self)
print("跑")
class Husky(Dog)
def __init__(self):
super().__init__()
self.skin = "black"
coco = Husky()
print(coco.skin)
\ No newline at end of file
class Hero:
def __init__(self,name)
self.level = 1
self.hp = 250
self.attack = 40
self.name = name
def combat(self,enemy)
info1 = self.name+"对"+evemy+"发起攻击"
info2 = "造成"+str(self.attack)+"伤害"
enemy.hp -= self.attack
if enemy.hp > 0:
info3 = enemy.name+"剩下"+str(enemy.hp)+
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