From 1796f2eaa059e0428d27ff8ce4340409ab40fc41 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Thu, 30 Mar 2023 11:41:57 +0800 Subject: [PATCH] auto save --- diy2.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/diy2.py b/diy2.py index 9db029e..7d86fba 100644 --- a/diy2.py +++ b/diy2.py @@ -23,12 +23,15 @@ class Hero: # 英雄类 class Player(Hero): # 玩家英雄 - def __init__(self,name): + def __init__(self,name,type): super().__init__(name) self.hp=240 self.attack=24 + self.type=type + print("有英雄创建成功,英雄名称:"+self.name+"英雄类型:"+self.type) + print("英雄血量",self.hp,"英雄攻击力:",self.attack,"英雄级别:",self.level) -player = Player("后羿") -print("玩家的血量值为:",player.hp) -print("玩家的攻击力为:",player.attack) +player = Player("后羿","射手") +yase=Player("亚瑟","战士") + -- libgit2 0.25.0