def RunGame():
    BUTTON_BUILD = False   <<<< 이값이 안변함;;;
    
    click = False
    flag=True
    count=0
    BuildB=button(10,500,50,35) ##건설버튼 생성
    Build1=button(100,400,100,100) #################
    Build2=button(250,400,100,100) #               #
    Build3=button(400,400,100,100) #  건설버튼 생성  #
    Build4=button(100,200,100,100) #               #
    Build5=button(250,200,100,100) #               #
    Build6=button(400,200,100,100) #################

    T1=Tower1()
    T2 = Tower2()
    T3 = Tower3()
    T4 = Tower4()
    T5 = Tower5()
    T6 = Tower6()

    while flag: ## 게임시작 루프

        clock.tick(60)
        for event in pygame.event.get(): ##종료인식

            if event.type == pygame.QUIT:
                flag=False
            if event.type == pygame.MOUSEMOTION:
                pos = pygame.mouse.get_pos() ##마우스좌표 pos에 입력
            if event.type==pygame.MOUSEBUTTONUP:
                click=False
            if event.type == pygame.MOUSEBUTTONDOWN:
                click=True
                if BuildB.isOver(pos):
                    BUTTON_BUILD=True  <<여기선 잘변함 ;;
             

                    if BUTTON_BUILD == True:
                        Drect(1)
                if Build1.isOver(pos):
                    BUTTON_BULD = False <<<< 여기서 안변하네요..
                    T1.Pimage()
                    print(BUTTON_BUILD)
                elif Build2.isOver(pos):
                    BUTTON_BULD = False
                    T2.Pimage()
                    print(BUTTON_BUILD)
                elif Build3.isOver(pos):
                    BUTTON_BULD = False
                    T3.Pimage()
                    print(BUTTON_BUILD)
                elif Build4.isOver(pos):
                    BUTTON_BULD = False
                    T4.Pimage()
                    print(BUTTON_BUILD)
                elif Build5.isOver(pos):
                    BUTTON_BULD = False
                    T5.Pimage()
                    print(BUTTON_BUILD)
                elif Build6.isOver(pos):
                    BUTTON_BULD = False
                    T6.Pimage()
                    print(BUTTON_BUILD)

            if (Build1.isOver(pos)==True)and(BUTTON_BUILD==True):
                Drect(2)
            elif (Build2.isOver(pos)==True)and(BUTTON_BUILD==True):
                Drect(3)
            elif (Build3.isOver(pos) == True) and (BUTTON_BUILD == True):
                Drect(4)
            elif (Build4.isOver(pos) == True) and (BUTTON_BUILD == True):
                Drect(5)
            elif (Build5.isOver(pos) == True) and (BUTTON_BUILD ==True):
                Drect(6)
            elif (Build6.isOver(pos) == True) and (BUTTON_BUILD == True):
                Drect(7)

        screen.blit(buttoni,(10,500))##건설버튼 생성
        pygame.display.flip()

    pygame.quit()

 

건설이란 버튼을 클릭했을때 

BUTTON_BUILD이 True값으로 변하면서 이 버튼이 활성화된 상태이다를 표시하고

원하는 자리에 건물을 건설하면 다시 이값을 False로 바꾸고싶은데 건설했을때 print는 출력되는데 False값으로 안바뀌는데 혹시 문제가 뭔지 알 수 있을가요?

댓글 0

파일 첨부

여기에 파일을 끌어 놓거나 파일 첨부 버튼을 클릭하세요.

파일 크기 제한 : 0MB (허용 확장자 : *.*)

0개 첨부 됨 ( / )
 
번호 제목 글쓴이 날짜 조회 수
공지 더이상 질문 게시판에서 질문을 받지 않습니다 백안시 2016.10.01 8527
공지 백안시의 공방 질문 게시판입니다 백안시 2016.09.05 922
공지 스크립트를 알아보기 쉽게 글에 입력하는 방법 백안시 2016.08.26 2060
공지 제목에 질문 내용을 명확하게 적어주세요 백안시 2016.08.26 66645
254 한국에서 명화 사용은 불법임 대운스 2021.07.12 41
253 홍콩에서 사고 한국에서 팔고...20억 챙긴 대학생 경비원 2021.07.12 67
252 제주항공 갑질논란 로리타율마 2021.07.11 33
251 팬에게 팩트 폭행당한 이지은 당당 2021.07.11 39
250 대표님에게 유독 혼나던 이사님의 정체.jpg 시린겨울 2021.07.11 41
249 지하철 먼지팁 아리랑22 2021.07.11 41
248 골프공 쳤는데 번개 맞음.gif 뼈자 2021.07.11 48
247 북한 최고위층 자녀가 탈북한 이유 마을에는 2021.07.10 39
246 Write for on the actual athletic [1] baidai66 2018.07.12 1153
» 파이게임 마우스클릭시 값변화가안되네요... True 2020.05.20 393
244 Like the wine cultivated in the vineyards hsdhj 2019.12.07 408
243 It was a great game for us dhsh 2019.12.07 88533
242 forget Nyborg bet go after the actual market gdfg 2019.12.07 89657
241 forget Nyborg bet go after the actual market gdfg 2019.12.07 287
240 절실함이 느껴지는 운전자 달콤한도시 2019.05.31 208
239 중국인들의 습관ㄷㄷㄷ 물고기 2019.05.29 184
238 한중일 결혼 비용 비교 아수크림중독 2019.05.28 191
237 부담스런 시선 반이다반 2019.05.27 358
236 2000만원 짜리를 30만원에 땅콩쿠기 2019.05.24 314
235 2000만원 짜리를 30만원에 땅콩쿠기 2019.05.24 581