class Item():
def __init__(self, name, cost, image):
self.name = name
self.cost = cost
self.image = image
class Weapon(Item):
def __init__(self, name, cost, image, damage):
self.damage = damage
super().__init__(name, cost, image)
class W_S(Weapon):
def __init__(self):
super().__init__(name="Wooden Sword", cost = 50, damage = 3, image = pygame.image.load('wood_sword.png')
class S_S(Weapon): #Syntax error here
def __init__(self):
super().__init__(name="Stone Sword", cost = 75, damage = 6, image = pygame.image.load('stone_sword.png')
class I_S(Weapon):
def __init__(self):
super().__init__(name="Iron Sword", cost = 100, damage = 9, image = pygame.image.load('iron_sword.png')
我正在尝试为S_S(石剑)创建一个基本的武器子类,我收到一个错误,突出显示class
中的单词class S_S(Weapon):
。
答案 0 :(得分:1)
您在调用guest
的所有行的末尾都缺少结束语。