0
수업을 한 번만 호출 할 수 있습니다. 내 코드는 다음과 같습니다pygame.Surface.blit 내부 클래스 사용
class fish:
def __init__(self, x, y, image, speed):
self.x = x
self.y = y
self.image = image
self.speed = speed
def be(self):
screen.blit(self.image, (self.x, self.y))
self.x -= self.speed
if boot.x+36 > self.x and boot.x < self.x+5:
if boot.y+34 > self.y and boot.y < self.y+5:
boot.live -= 1
boot.x = 100
boot.y = 460
fishes = []
fishes.append(fish(900, 300, fish_1, 1))
그리고 게임 루프 (내부 또는 외부 '물고기'객체를 호출 할 때 fishes.append(fish(900, 300, fish_1, 1))
내가 가지고 오류 :
TypeError: 'fish' object is not callable
당신은 '생선'클래스를 정의하지만 다른 곳에서는 같은 na 나를. 클래스 이름을 Fish로 변경하고 생성자 호출을 'Fish (900, 300, fish_1, 1)'로 변경하십시오. –
@BartlomiejLewandowski 의견으로 답변을 게시해야합니다. – sloth