pygame으로 만든 게임... 코드 일부분이 문제가 있어요.... 도와주세요..

조회수 62회
import pygame.locals
import gameCode.player_ant
import gameCode.soil
pygame.init()
display = pygame.display.set_mode((1280, 720))
displaySurface = pygame.Surface(display.get_size())
clock = pygame.time.Clock()
setPlayerX = 0
setPlayerY = 10
esc = True
playerFlipX = False
playerFlipY = False
mousePosX = 0
mousePosY = 0
soilPosGroupX = list()
soilPosGroupY = list()
soilTag = 0
soilGroup = list()
soilGroupLen = len(soilGroup)
print(soilGroupLen)
pointed = True
checkSoil = 0
soilMouse_betweenX = list()
soilMouse_betweenY = list()
soilMouse_betweenX_abs = list()
soilMouse_betweenY_abs = list()
soilMouse_betweenX_min = 0
soilMouse_betweenY_min = 0
soilMouse_betweenX_min_num = 0
soilMouse_betweenY_min_num = 0
soilMouse_betweenX_Last_min = 0
soilMouse_between_min_pos_soilX = 0
soilMouse_between_min_pos_soilY = 0
def sign(number):
    if number > 0:
        return True
    elif number < 0:
        return False
    elif number == 0:
        return None

while esc:
    pygame.display.init()
    display.fill((255, 255, 255))
    mouseClick1, mouseClick2, mouseClick3 = pygame.mouse.get_pressed()
    mousePosX, mousePosY = pygame.mouse.get_pos()

    if soilGroupLen > 0: # <-- 이 부분
        while pointed:
            checkSoil += 1
            if checkSoil == soilGroupLen:
                soilMouse_betweenX_min = min(soilMouse_betweenX_abs)
                soilMouse_betweenY_min = min(soilMouse_betweenY_abs)
                soilMouse_betweenX_min_num = soilMouse_betweenX_abs.index(soilMouse_betweenX_min)
                soilMouse_between_min_pos_soilX = soilMouse_betweenX_abs.index(soilMouse_betweenX_min)
                soilMouse_between_min_pos_soilY = soilMouse_betweenY_abs.index(soilMouse_betweenY_min)
                pointX_bool = sign(soilMouse_between_min_pos_soilX)
                pointY_bool = sign(soilMouse_between_min_pos_soilY)
                pointed = False
            soilPosGroupX_out = soilPosGroupX[checkSoil]
            soilPosGroupY_out = soilPosGroupY[checkSoil]
            soilMouse_betweenX[checkSoil] = mousePosX - soilPosGroupX_out
            soilMouse_betweenY[checkSoil] = mousePosY - soilPosGroupY_out
            soilMouse_betweenX_abs[checkSoil] = abs(soilMouse_betweenX[checkSoil])
            soilMouse_betweenY_abs[checkSoil] = abs(soilMouse_betweenX[checkSoil])
            print(soilMouse_betweenX_abs[checkSoil])
            print(soilMouse_betweenY_abs[checkSoil]) # <--- 이 부분까지 
    else:
        pass
    if mouseClick1 and soilGroupLen == 0:
        print(soilGroupLen)
        soilTag += 1
        soilPosXSet = mousePosX - 50
        soilPosYSet = mousePosY - 50
        soilPosGroupX.append(soilPosXSet)
        soilPosGroupY.append(soilPosYSet)
        exec("global soilObject%s" % (soilTag))
        exec("soilObject%s = pygame.image.load('image/soil.bmp')" % (soilTag))
        exec("soilGroup.append(soilObject%s)" % (soilTag))
    elif mouseClick1 and soiGroupLen > 0:
        print(soilGroupLen)
        soilTag += 1
        soilPosXSet = mousePosX - 50
        soilPosYSet = mousePosY - 50
        soilPosGroupX.append(soilPosXSet)
        soilPosGroupY.append(soilPosYSet)
        exec("global soilObject%s" % (soilTag))
        exec("soilObject%s = pygame.image.load('image/soil.bmp')" % (soilTag))
        exec("soilGroup.append(soilObject%s)" % (soilTag))
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            esc = False
    playerObject = gameCode.player_ant.Player(0, playerFlipX, playerFlipY)
    playerX, playerFlipX = playerObject.event()
    setPlayerX += playerX
    display.blit(playerObject.loadImage, (setPlayerX, setPlayerY))
    playerRender = pygame.sprite.RenderPlain(playerObject)
    playerObject.update()
    loopSoilBlit = 0
    soilGroupLen = len(soilGroup)
    if soilGroupLen > 0:
        for loopSoilBlit in range(soilGroupLen):
            soilGroup_out = soilGroup[loopSoilBlit]
            soilPosGroupX_out = soilPosGroupX[loopSoilBlit]
            soilPosGroupY_out = soilPosGroupY[loopSoilBlit]
            display.blit(soilGroup_out, (soilPosGroupX_out, soilPosGroupY_out))
    else:
        pass

    pygame.display.flip()
    pygame.display.update()
    clock.tick(60)
pygame.quit()

ValueError: min() arg is an empty sequence

라고 에러가 나오는데 뭐가 잘못된지 잘 모르겠어요... 알려주세요...

1 답변

답변을 하려면 로그인이 필요합니다.

Hashcode는 개발자들을 위한 무료 QnA 사이트입니다. 계정을 생성하셔야만 답변을 작성하실 수 있습니다.

(ಠ_ಠ)
(ಠ‿ಠ)

ᕕ( ᐛ )ᕗ
로그인이 필요합니다

Hashcode는 개발자들을 위한 무료 QnA사이트 입니다. 계정을 생성하셔야만 글을 작성하실 수 있습니다.