-
카테고리
-
세부 분야
프로그래밍 언어
-
해결 여부
미해결
오류관련
22.01.11 10:56 작성 조회수 173
0
class Unit:
def __init__(self,name,hp,damage):
self.name=name
self.hp=hp
self.damage=damage
print('{0} 유닛이 생성 되었습니다.'.format(self.name))
print('체력 {0}, 공격력 {1}'.format(self.hp,self.damage))
class AttackUnit:
def __init__(self,name,hp,damage):
self.name=name
self.hp=hp
self.damage=damage
def attack(self,location):
print('{0} : {1} 방향으로 적군을 공격 합니다. [공격력 {2}'\
.format(self.name,location,self.damage))
def damaged(self,damage):
print('{0} : {1} 데미지를 입었습니다.'.format(self.name,damage))
self.hp-=damage
print('{0} : 현재 체력은 {1} 입니다.'.format(self.name,self.hp))
if self.hp<=0:
print('{0} : 파괴되었습니다.'.format(self.name))
firebat1 = AttackUnit("파이어뱃",50,16)!!!!!
firebat1.attack('5시')
firebat1.damaged(25)
firebat1.damaged(25)
느낌표 있는 줄에서 AttackUnit이 정의되지 않았다고 뜹니다...
답변을 작성해보세요.
답변 0