• 카테고리

    질문 & 답변
  • 세부 분야

    게임 프로그래밍

  • 해결 여부

    미해결

무기랑 공이 닿으면 쪼개지는데 쪼개진 공2개중 오른쪽으로 나오는 공은 잘 움직이는데 왼쪽으로 움직여야되는 공이 멈춤니다

21.03.13 02:10 작성 조회수 91

0

 if ball_img_idx < 3:

                     
                    #현재 공 크기 정보
                    ball_width = ball_rect.size[0]
                    ball_height = ball_rect.size[1]

                    #나눠진 공 정보
                    small_ball_rect = ball_images[ball_img_idx + 1].get_rect()
                    small_ball_width = small_ball_rect.size[0]
                    small_ball_height = small_ball_rect.size[1]

                    #왼쪽으로 팅겨 나가는 작은 공
                    balls.append({
                        "pos_x" : ball_pos_x + (ball_width / 2- (small_ball_width / 2), #공의 x좌표
                        "pos_y" : ball_pos_y + (ball_height / 2- (small_ball_height / 2), #공의 y좌표
                        "img_idx" : ball_img_idx + 1#공의 이미지 인덱스
                        "to_x"-3#x축 이동 방향(+ 오른쪽, - 왼쪽) 
                        "to_y"-6#t축 이동 방향
                        "init_spd_y" : ball_speed_y[ball_img_idx + 1#y 최초 속도
                    })

                    #오른쪽으로 튕겨 나가는 작은 공 
                    balls.append({
                        "pos_x" : ball_pos_x + (ball_width / 2- (small_ball_width / 2), #공의 x좌표
                        "pos_y" : ball_pos_y + (ball_height / 2- (small_ball_height / 2), #공의 y좌표
                        "img_idx"  : ball_img_idx + 1#공의 이미지 인뎃스
                        "to_x"+3#x축 이동 방향(+ 오른쪽, - 왼쪽) 
                        "to_y"-6#t축 이동 방향
                        "init_spd_y" : ball_speed_y[ball_img_idx + 1#y 최초 속도
                    })
                break

답변 0

답변을 작성해보세요.

답변을 기다리고 있는 질문이에요.
첫번째 답변을 남겨보세요!