서론

이 게임은 대학 파이썬 1학년 1학기 전공 수업에서 진행했던 텀프로젝트의 결과물입니다.

파이썬을 배웠기 때문에 파이썬을 이용해 텀프로젝트를 진행해야 했고, 대부분은 파이썬을 이용한 데이터 분석을 주제로 하였지만, 저는 데이터 분석보다는 직접 게임을 만들어 보고 싶었기 때문에 pygame 모듈을 이용해 게임을 만들고자 했습니다. (이는 나중에 후회로 이어지지만...)

처음으로 '무'에서 '유'를 창조한 경험이였기 때문에 무척이나 힘들었지만 그만큼 성취감도 컸던 것 같습니다.

 

본론

이 게임을 프로그램으로 만들기 위해서는 무엇보다도 룰과 게임의 진행방식을 정확하게 파악하는 것이 중요했습니다.

그래서 먼저 룰을 조사했습니다.

 

< 흑과백 2 >

  1. '흑과백 2'는 한정된 포인트를 라운드마다 나누어 대결에 사용하며 더 많은 승점을 획득한 플레이어가 승리하는 게임이다.
  2. '흑과백 2'는 두 플레이어가 각각 99포인트 씩 가지고 시작한다.
  3. 게임은 총 아홉 라운드로 진행되며 플레이어는 라운드마다 99포인트 중 원하는 만큼의 포인트를 사용할 수 있다.
  4. 선 플레이어가 해당 라운드에 사용할 포인트를 결정하면 사용한 포인트가 한 자릿수일 경우 검은색, 두 자릿수일 경우 흰색으로 표시된다. 흑과 백 표시를 단서로 후 플레이어가 포인트를 결정하면 후 플레이어의 포인트 역시 흑과 백으로 표시되며 해당 라운드에서 더 많은 포인트를 사용한 플레이어는 승점 1점을 획득한다.
  5. 사용할 포인트는 소멸되며 남은 포인트는 5단계 표시등으로 공개된다.
  6. 99포인트 중 20포인트 씩 줄어들 때마다 한 단계씩 표시등이 꺼지게 되며 포인트를 입력한 순간 적용된다. 상대방의 남은 포인트가 0점이라도 마지막 표시등은 꺼지지 않는다.
  7. 선 플레이어가 현재 단계보다 낮아지는 포인트를 사용했다면 후 플레이어가 사용할 포인트를 결정하기 전에 표시된다.
  8. 9라운드 종료 시 승점이 더 높은 플레이어가 승리하며 게임 도중 한 플레이어가 승점 5점을 먼저 획득하면 그 즉시 해당 플레이어의 승리로 게임이 종료된다.

 

그러고 나서는 input을 이용해 간단하게 '흑과백2' 게임을 만들어보았습니다. (위에 적힌 룰과 조금 다를 수 있음)

 

player1_point = 99
player2_point = 99
player1_score = 0
player2_score = 0

for i in range(1,10):
    print("Round ",i)
    p1=int(input(prompt="p1)제시할 포인트를 입력해 주세요.")) 
    while player1_point-p1<0:
        p1=int(input(prompt="포인트를 초과하셨습니다. 다시 입력해주세요."))
    player1_point-=p1
    if p1>=0 and p1<10: #한 자리 수 일 경우 "흑"표시
        print("Black")
    else:
        print("White") #두 자리 수 일 경우 "백"표시
    if player1_point<=79 and player1_point>=60:
        print("표시등이 꺼집니다.")
    elif player1_point<=59 and player1_point>=40:
        print("표시등이 꺼집니다.")
    elif player1_point<=39 and player1_point>=20:
        print("표시등이 꺼집니다.")
    elif player1_point<=19 and player1_point>=0:
        print("표시등이 꺼집니다.")

    p2=int(input(prompt="p2)제시할 포인트를 입력해 주세요."))
    while player2_point-p2<0:
        p2=int(input(prompt="포인트를 초과하셨습니다. 다시 입력해주세요."))
    player2_point-=p2
    if p2>=0 and p2<10: 
        print("Black")
    else:
        print("White") 
    if player2_point<=79 and player2_point>=60:
        print("표시등이 꺼집니다.")
    elif player2_point<=59 and player2_point>=40:
        print("표시등이 꺼집니다.")
    elif player2_point<=39 and player2_point>=20:
        print("표시등이 꺼집니다.")
    elif player2_point<=19 and player2_point>=0:
        print("표시등이 꺼집니다.")
    
    #승점 계산
    if p1>p2:
        player1_score+=1
        print("p1 승점 1점 추가")
    elif p1<p2:
        player2_score+=1
        print("p2 승점 1점 추가")
    else:
        print("동점입니다.")

if player1_score>player2_score:
    print("p1 승")
if player1_score<player2_score:
    print("p2 승")

 

그 후, pygame을 어느정도 공부한 후 본격적인 게임 제작에 들어갔습니다.

아래는 pygame을 공부하는 데에 도움이 된 사이트, 책입니다.

 

코드

그리고, 아래는 pygame을 막 배우고, class를 배우기 전에 열심히 쓴 코드입니다.

"""
게임 설명
- 이 게임은 두 명의 플레이어가 대결하는 게임이다.
- 숫자를 입력할 때에는 키보드를 손으로 가려 상대가 보지 못하도록 해야한다.
- '더 지니어스 흑과백2'의 룰, 게임 진행 방식과 동일하다. (관련 영상 : https://www.youtube.com/watch?v=xHcGb_Q4po0)
- 순서는 P1을 시작으로 두 번째 Round 부터는 이전 Round에서 후공이였던 플레이어가 선공이 되어 point를 제시한다.
- point를 입력하고 스페이스바를 누른 뒤, "point is over"라는 문구가 뜨지 않는다면 'z'를 누르도록 한다.
"""

import pygame
import sys

#1. 게임 초기화
pygame.init()

#2. 게임창 옵션 설정
pygame.display.set_caption("Black and White 2")
screen_width = 1200
screen_height = 700
size=(screen_width,screen_height)
screen = pygame.display.set_mode(size)

#3. 게임 내 필요한 설정
clock = pygame.time.Clock()

#color
bg_color = (224,224,224)
black = (0,0,0)
white = (255,255,255)
red = (255, 0, 0)
yellow = (255, 255, 100)
dark_yellow = (120, 120, 0)
color_passive = pygame.Color('gray15')
score_color = (149, 149, 161)
blue = (0, 0, 255)

#font
round_font = pygame.font.SysFont(None, 70)
player_font = pygame.font.SysFont(None, 40)
score_font = pygame.font.SysFont(None, 50)
rect_font = pygame.font.SysFont(None, 40)
light_font = pygame.font.SysFont(None, 32)
warning_font = pygame.font.SysFont(None, 30)

#변수
player1_point = 99
player2_point = 99
player1_score = 0
player2_score = 0

round_number = 1

idx = 0

color_1 = yellow
color_2 = yellow
color_3 = yellow
color_4 = yellow
color_5 = yellow
color_6 = yellow
color_7 = yellow
color_8 = yellow
color_9 = yellow
color_10 = yellow

is_play = 0

#input 
user_input = ''
user_see = ''
active = False

#sound
effect_sound = pygame.mixer.Sound("effectsound.wav")
point_sound = pygame.mixer.Sound("pointsound.wav")
result_sound = pygame.mixer.Sound("resultsound.wav")
yourturn_sound = pygame.mixer.Sound("yourturn.wav")

#4. 메인 (순서 : p1-p2-p2-p1-p1-...)
play = True
while play:

    #FPS 설정
    clock.tick(5)

    
    
    #그리기

    background = pygame.image.load("background.png")
    screen.blit(background, (0,0))

    interfaceBox = pygame.image.load("interfaceBox.png")
    screen.blit(interfaceBox, (400,120))   

    p1_text = player_font.render("Player1", True, red) 
    screen.blit(p1_text, (30,60))
    p1_score_text = score_font.render("{}".format(player1_score), True, red) 
    screen.blit(p1_score_text, (70,500))

    p2_text = player_font.render("Player2", True, blue) 
    screen.blit(p2_text, (screen_width-130,60))
    p2_score_text = score_font.render("{}".format(player2_score), True, blue) 
    screen.blit(p2_score_text, (screen_width-88,500))



    #입력 박스
    input_rect = pygame.Rect(560,400,100,40)
    input_color = pygame.Color('gray15')
    pygame.draw.rect(screen,input_color,input_rect,3)
    text_surface = rect_font.render(user_see,True,(255,255,255))
    screen.blit(text_surface,(input_rect.x+5, input_rect.y+5))



    if idx == 0: #p1 점수입력
        
        round_text = round_font.render('Round {}'.format(round_number), True, black) 
        screen.blit(round_text, (screen_width/2-83,20))
        p1_input_text = rect_font.render("Please enter points", True, red) 
        screen.blit(p1_input_text, (477,160))

        z_text = warning_font.render("press 'space' / no warning --> press 'z'", True, black)
        screen.blit(z_text, (425,450))
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                play = False
            if event.type == pygame.MOUSEBUTTONDOWN:
                if input_rect.collidepoint(event.pos):
                    active = True #active를 True로 바꿔주어 input이 가능하게 함
            if event.type == pygame.KEYDOWN:
                if active == True:
                    if event.key == pygame.K_BACKSPACE: #지우기 기능
                        user_see = user_see[:-1]
                        user_input = user_input[:-1]
                    else:
                        user_see += '*' #블러처리로 상대가 숫자 확인 하지 못하게 함(키보드로 숫자를 입력할 때에는 가리고 해야함)
                        user_input += event.unicode 
                    if event.key == pygame.K_SPACE:
                        p1 = int(user_input[:-1])

                        if player1_point - p1<0:
                            p1_input_text = rect_font.render("point is over", True, black) 
                            screen.blit(p1_input_text, (520,310))
                            user_input=''
                            user_see=''
                            
                            
                        
                        
                    if event.key == pygame.K_z:
                        player1_point-=p1
                        idx = 1
                        is_play = 1

    
        
    elif idx == 1: #p1 결과
        if is_play == 1:
            effect_sound.play()
            is_play = 0

        round_text = round_font.render('Round {}'.format(round_number), True, black) 
        screen.blit(round_text, (screen_width/2-83,20))
        nextTurn_text = rect_font.render("next turn => press 'z'", True, black)
        screen.blit(nextTurn_text, (475,180))

        if p1>=0 and p1<10:
            black_text = rect_font.render("Black", True, black)
            screen.blit(black_text, (560,150))
            user_input=''
            user_see=''
        else:
            white_text = rect_font.render("White", True, black)
            screen.blit(white_text, (560,150))
            user_input=''
            user_see=''

        if player1_point<=79 and player1_point>=60:

            color_1=dark_yellow
            
        elif player1_point<=59 and player1_point>=40:
            
            color_1=dark_yellow
            color_2=dark_yellow

        elif player1_point<=39 and player1_point>=20:    
            
            color_1=dark_yellow
            color_2=dark_yellow
            color_3=dark_yellow

        elif player1_point<=19 and player1_point>=0:    
            
            color_1=dark_yellow
            color_2=dark_yellow
            color_3=dark_yellow
            color_4=dark_yellow

        for event in pygame.event.get():            
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_z:
                        idx = 2
                        is_play = 1




    elif idx == 2: #p2 점수 입력
        if is_play == 1:
            yourturn_sound.play()
            is_play = 0

        round_text = round_font.render('Round {}'.format(round_number), True, black) 
        screen.blit(round_text, (screen_width/2-83,20))
        p2_input_text = rect_font.render("Please enter points", True, blue) 
        screen.blit(p2_input_text, (477,160))

        z_text = warning_font.render("press 'space' / no warning --> press 'z'", True, black)
        screen.blit(z_text, (425,450))
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                play = False
            if event.type == pygame.MOUSEBUTTONDOWN:
                if input_rect.collidepoint(event.pos):
                    active = True 
            if event.type == pygame.KEYDOWN:
                if active == True:
                    if event.key == pygame.K_BACKSPACE: 
                        user_input = user_input[:-1]
                        user_see=user_see[:-1]
                    else:
                        user_input += event.unicode 
                        user_see+='*'
                    if event.key == pygame.K_SPACE:
                        p2 = int(user_input[:-1])
                        

                        if player2_point - p2<0:
                            p2_input_text = rect_font.render("point is over", True, black) 
                            screen.blit(p2_input_text, (520,310))
                            user_input=''
                            user_see=''
                        
                        
                    if event.key == pygame.K_z:
                        player2_point-=p2
                        idx = 3
                        is_play = 1
        




    elif idx == 3: #p2 결과
        if is_play == 1:
            effect_sound.play()
            is_play = 0
                    
        round_text = round_font.render('Round {}'.format(round_number), True, black) 
        screen.blit(round_text, (screen_width/2-83,20))
        nextTurn_text = rect_font.render("look result => press 'z'", True, black)
        screen.blit(nextTurn_text, (473,180))


        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                play = False
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_z:
                    idx = 4     
                    is_play = 1

                    if p1>p2:
                        player1_score+=1    
                    elif p1<p2:
                        player2_score+=1
                                    

        if p2>=0 and p2<10:
            black_text = rect_font.render("Black", True, black)
            screen.blit(black_text, (560,150))
            user_input=''
            user_see=''
        else:
            white_text = rect_font.render("White", True, black)
            screen.blit(white_text, (560,150))
            user_input=''
            user_see=''

        if player2_point<=79 and player2_point>=60:
            color_6=dark_yellow
            
        elif player2_point<=59 and player2_point>=40:
            
            color_6=dark_yellow
            color_7=dark_yellow

        elif player2_point<=39 and player2_point>=20:    
            
            color_6=dark_yellow
            color_7=dark_yellow
            color_8=dark_yellow

        elif player2_point<=19 and player2_point>=0:    
            
            color_6=dark_yellow
            color_7=dark_yellow
            color_8=dark_yellow
            color_9=dark_yellow





    elif idx == 4: #승점 계산
        if is_play == 1:
            point_sound.play()
            is_play = 0

        round_text = round_font.render('Round {}'.format(round_number), True, black) 
        screen.blit(round_text, (screen_width/2-83,20))
        nextTurn_text = rect_font.render("next Round => press 'z'", True, black)
        screen.blit(nextTurn_text, (460,350))
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                play = False
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_z:
                    round_number+=1
                    idx = 5     
                    is_play = 1
        if p1>p2:
            player1_win_text = rect_font.render('p1 win', True, red) 
            screen.blit(player1_win_text, (screen_width/2-33,160))
        elif p1<p2:
            player2_win_text = rect_font.render('p2 win', True, blue) 
            screen.blit(player2_win_text, (screen_width/2-33,160))
        else:
            same_text = rect_font.render('same', True, black) 
            screen.blit(same_text, (screen_width/2-33,160))




    elif idx == 7: #p1 점수입력
        if is_play == 1:
            yourturn_sound.play()
            is_play = 0

        round_text = round_font.render('Round {}'.format(round_number), True, black) 
        screen.blit(round_text, (screen_width/2-83,20))
        p1_input_text = rect_font.render("Please enter points", True, red) 
        screen.blit(p1_input_text, (477,160))

        z_text = warning_font.render("press 'space' / no warning --> press 'z'", True, black)
        screen.blit(z_text, (425,450))
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                play = False
            if event.type == pygame.MOUSEBUTTONDOWN:
                if input_rect.collidepoint(event.pos):
                    active = True
            if event.type == pygame.KEYDOWN:
                if active == True:
                    if event.key == pygame.K_BACKSPACE: 
                        user_input = user_input[:-1]
                        user_see=user_see[:-1]
                    else:
                        user_input += event.unicode 
                        user_see+='*'
                    if event.key == pygame.K_SPACE:
                        p1 = int(user_input[:-1])

                        if player1_point - p1<0:
                            p1_input_text = rect_font.render("point is over", True, black) 
                            screen.blit(p1_input_text, (520,310))
                            user_input=''
                            user_see=''
                            
                            
                        
                    if event.key == pygame.K_z:
                        player1_point-=p1
                        idx = 8
                        is_play = 1

    
        

    elif idx == 8: #p1 결과
        if is_play == 1:
            effect_sound.play()
            is_play = 0        
        round_text = round_font.render('Round {}'.format(round_number), True, black) 
        screen.blit(round_text, (screen_width/2-83,20))
        nextTurn_text = rect_font.render("look result => press 'z'", True, black)
        screen.blit(nextTurn_text, (473,180))

        if p1>=0 and p1<10:
            black_text = rect_font.render("Black", True, black)
            screen.blit(black_text, (560,150))
            user_input=''
            user_see=''
        else:
            white_text = rect_font.render("White", True, black)
            screen.blit(white_text, (560,150))
            user_input=''
            user_see=''

        if player1_point<=79 and player1_point>=60:

            color_1=dark_yellow
            
        elif player1_point<=59 and player1_point>=40:
            
            color_1=dark_yellow
            color_2=dark_yellow

        elif player1_point<=39 and player1_point>=20:    
            
            color_1=dark_yellow
            color_2=dark_yellow
            color_3=dark_yellow

        elif player1_point<=19 and player1_point>=0:    
            
            color_1=dark_yellow
            color_2=dark_yellow
            color_3=dark_yellow
            color_4=dark_yellow

        for event in pygame.event.get():            
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_z:
                    idx = 9
                    is_play = 1

                    if p1>p2:
                        player1_score+=1    
                    elif p1<p2:
                        player2_score+=1                    




    elif idx == 5: #p2 점수 입력
        if is_play == 1:
            yourturn_sound.play()
            is_play = 0

        round_text = round_font.render('Round {}'.format(round_number), True, black) 
        screen.blit(round_text, (screen_width/2-83,20))
        p2_input_text = rect_font.render("Please enter points", True, blue) 
        screen.blit(p2_input_text, (477,160))

        z_text = warning_font.render("press 'space' / no warning --> press 'z'", True, black)
        screen.blit(z_text, (425,450))
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                play = False
            if event.type == pygame.MOUSEBUTTONDOWN:
                if input_rect.collidepoint(event.pos):
                    active = True 
            if event.type == pygame.KEYDOWN:
                if active == True:
                    if event.key == pygame.K_BACKSPACE: 
                        user_input = user_input[:-1]
                        user_see=user_see[:-1]
                    else:
                        user_input += event.unicode 
                        user_see+='*'
                    if event.key == pygame.K_SPACE:
                        p2 = int(user_input[:-1])
                        
                        if player2_point - p2<0:
                            p2_input_text = rect_font.render("point is over", True, black) 
                            screen.blit(p2_input_text, (520,310))
                            user_input=''
                            user_see=''
                        
                        
                    if event.key == pygame.K_z:
                        player2_point-=p2
                        idx = 6
                        is_play = 1
        



    elif idx == 6: #p2 결과
        if is_play == 1:
            effect_sound.play()
            is_play = 0        

        round_text = round_font.render('Round {}'.format(round_number), True, black) 
        screen.blit(round_text, (screen_width/2-83,20))
        nextTurn_text = rect_font.render("next turn => press 'z'", True, black)
        screen.blit(nextTurn_text, (475,180))


        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                play = False
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_z:
                    idx = 7     
                    is_play = 1

                            
        if p2>=0 and p2<10:
            black_text = rect_font.render("Black", True, black)
            screen.blit(black_text, (560,150))
            user_input=''
            user_see=''
        else:
            white_text = rect_font.render("White", True, black)
            screen.blit(white_text, (560,150))
            user_input=''
            user_see=''

        if player2_point<=79 and player2_point>=60:
            color_6=dark_yellow
            
        elif player2_point<=59 and player2_point>=40:
            
            color_6=dark_yellow
            color_7=dark_yellow

        elif player2_point<=39 and player2_point>=20:    
            
            color_6=dark_yellow
            color_7=dark_yellow
            color_8=dark_yellow

        elif player2_point<=19 and player2_point>=0:    
            
            color_6=dark_yellow
            color_7=dark_yellow
            color_8=dark_yellow
            color_9=dark_yellow




    elif idx == 9: #승점 계산
        if is_play == 1:
            point_sound.play()
            is_play = 0        

        round_text = round_font.render('Round {}'.format(round_number), True, black) 
        screen.blit(round_text, (screen_width/2-83,20))
        nextTurn_text = rect_font.render("next Round => press 'z'", True, black)
        screen.blit(nextTurn_text, (460,350))
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                play = False
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_z:
                    round_number+=1
                    idx = 0     
                    is_play = 1

        if p1>p2:
            player1_win_text = rect_font.render('p1 win', True, red) 
            screen.blit(player1_win_text, (screen_width/2-33,160))
        elif p1<p2:
            player2_win_text = rect_font.render('p2 win', True, blue)
            screen.blit(player2_win_text, (screen_width/2-33,160))
        else:
            same_text = rect_font.render('same', True, black) 
            screen.blit(same_text, (screen_width/2-33,160))




    elif idx == 10: #종료
        if is_play == 1:
            result_sound.play()
            is_play = 0
        winner_text = rect_font.render('{}'.format(winner), True, black)
        screen.blit(winner_text, (screen_width/2-100,160))
        again_text = rect_font.render("again : 'z'", True, black)
        screen.blit(again_text, (screen_width/2-60,310))
        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                play = False
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_z: #재시작 reset
                    round_number=1
                    player1_score=0
                    player2_score=0
                    player1_point=99
                    player2_point=99
                    color_1=yellow
                    color_2=yellow
                    color_3=yellow
                    color_4=yellow
                    color_5=yellow
                    color_6=yellow
                    color_7=yellow
                    color_8=yellow
                    color_9=yellow
                    color_10=yellow
                    idx = 0    



    #종료 조건
    if round_number==10 or player1_score==5 or player2_score==5:
        idx=10
        if player1_score == 5:
            winner="Player 1 is winner"
        elif player2_score == 5:
            winner="Player 2 is winner"
        if player1_score > player2_score:
            winner="Player 1 is winner"
        elif player1_score < player2_score:
            winner="Player 2 is winner"
        else:
            winner="     No winner    "
    
    
                    
    
    #잔여 point 표시등
    p1_rect1 = pygame.draw.rect(screen, color_1, (30, 100, 100, 70))  
    p1_rect2 = pygame.draw.rect(screen, color_2, (30, 180, 100, 70))  
    p1_rect3 = pygame.draw.rect(screen, color_3, (30, 260, 100, 70))  
    p1_rect4 = pygame.draw.rect(screen, color_4, (30, 340, 100, 70))  
    p1_rect5 = pygame.draw.rect(screen, color_5, (30, 420, 100, 70))  
    p2_rect1 = pygame.draw.rect(screen, color_6, (screen_width-130, 100, 100, 70))  
    p2_rect2 = pygame.draw.rect(screen, color_7, (screen_width-130, 180, 100, 70))  
    p2_rect3 = pygame.draw.rect(screen, color_8, (screen_width-130, 260, 100, 70))  
    p2_rect4 = pygame.draw.rect(screen, color_9, (screen_width-130, 340, 100, 70))  
    p2_rect5 = pygame.draw.rect(screen, color_10, (screen_width-130, 420, 100, 70))  
    

    p1_rect1_text = light_font.render("80 ~ 99", True, black) 
    screen.blit(p1_rect1_text, (41,125))
    p1_rect2_text = light_font.render("60 ~ 79", True, black) 
    screen.blit(p1_rect2_text, (41,205))
    p1_rect3_text = light_font.render("40 ~ 59", True, black) 
    screen.blit(p1_rect3_text, (41,285))
    p1_rect4_text = light_font.render("20 ~ 39", True, black) 
    screen.blit(p1_rect4_text, (41,365))
    p1_rect5_text = light_font.render("0 ~ 19", True, black) 
    screen.blit(p1_rect5_text, (48,445))
    p2_rect1_text = light_font.render("80 ~ 99", True, black) 
    screen.blit(p2_rect1_text, (screen_width-117,125))
    p2_rect2_text = light_font.render("60 ~ 79", True, black) 
    screen.blit(p2_rect2_text, (screen_width-117,205))
    p2_rect3_text = light_font.render("40 ~ 59", True, black) 
    screen.blit(p2_rect3_text, (screen_width-117,285))
    p2_rect4_text = light_font.render("20 ~ 39", True, black) 
    screen.blit(p2_rect4_text, (screen_width-117,365))
    p2_rect5_text = light_font.render("0 ~ 19", True, black) 
    screen.blit(p2_rect5_text, (screen_width-110,445))
    #업데이트
    pygame.display.flip()



#5. 게임 종료
pygame.quit()

 

나중에 다시 이 코드를 본다면 지저분해 보일 것 같으나 실제로 파이썬을 배우고 사용한지 오래되지 않았고, 처음으로 스스로 제작한 게임이므로 귀엽게 봐주도록 하자.

 

 

최종 플레이 영상

마지막으로 아래는 최종 플레이 영상입니다.

 

 

Review

실제로 제작하며 player의 실수에 따라 발생할 오류들이 몇 개 보였습니다. 나중에 시간이 된다면 이러한 오류들까지 고려한 완벽한 더지니어스 흑과백2 게임으로 업데이트 해서 돌아오도록 하겠습니다.

+ Recent posts