- chimp memory game
- ๊ฒฉ์ : 5 rows(ํ), 9 columns(์ด)
- start ๋ฒํผ
- 6 numbers (์์ฐจ ์ฆ๊ฐ)
- ๊ฒฉ์์ ์ซ์ ๋๋ค ์์นํ๊ธฐ
- Hide Numbers : 1. Display Time, 2. First Number
-
- ์๊ฐ์ด ์ง๋ ํ์ ์ซ์ ์จ๊ฒจ์ง
- 1์ ๋๋ฅด๋ฉด ๋๋จธ์ง ์ซ์ ์จ๊ฒจ์ง
-
- Correct → Next Level
- Wrong → Game Over
- ํ๋ ์ : 1_frame
- ๊ฐ๋ก 1280, ์ธ๋ก 720
import pygame
#์ด๊ธฐํ
pygame.init()
screen_width = 1280 #๊ฐ๋กํฌ๊ธฐ
screen_height = 720 #์ธ๋กํฌ๊ธฐ
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Memory Game")
#๊ฒ์ ๋ฃจํ
running = True #๊ฒ์์ด ์คํ์ค์ธ๊ฐ?ใ
while running :
#์ด๋ฒคํธ ๋ฃจํ
for event in pygame.event.get(): #์ด๋ค ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ์๋๊ฐ?
if event.type == pygame.QUIT : #์ฐฝ์ด ๋ซํ๋ ์ด๋ฒคํธ์ธ๊ฐ?
running = False #๊ฒ์์ด ๋์ด์ ์คํ์ค์ด ์๋
#๊ฒ์ ์ข
๋ฃ
pygame.quit()
- start screen
- start_button (120*120, ์ค์ฌ ์ขํ ๋์ผ, ๋ฐ์ง๋ฆ 60, ๋๊ป 5)
- pygame.draw.circle ์ด์ฉํ์ฌ ์ ๊ทธ๋ฆฌ๊ธฐ
import pygame #์์ ํ๋ฉด ๋ณด์ฌ์ฃผ๊ธฐ def display_start_screen() : pygame.draw.circle(screen, WHITE, start_button.center, 60, 5) #ํฐ์ ์, ์ค์ฌ์ขํ start_button์ ์ค์ฌ์ขํ, ๋ฐ์ง๋ฆ 60, ๋๊ผ 5 #์ด๊ธฐํ pygame.init() screen_width = 1280 #๊ฐ๋กํฌ๊ธฐ screen_height = 720 #์ธ๋กํฌ๊ธฐ screen = pygame.display.set_mode((screen_width, screen_height)) pygame.display.set_caption("Memory Game") #์์ ๋ฒํผ start_button = pygame.Rect(0,0,120,120) #๊ฐ๋ก ์ธ๋ก 120 start_button.center = (120, screen_height-120 ) #x์ขํ,y์ขํ ๊ธฐ์ค์ผ๋ก ์ค์ฌ๊ฐ ์ค์ #์๊น BLACK = (0,0,0) #RGB WHITE = (255,255,255) #๊ฒ์ ๋ฃจํ running = True #๊ฒ์์ด ์คํ์ค์ธ๊ฐ?ใ while running : #์ด๋ฒคํธ ๋ฃจํ for event in pygame.event.get(): #์ด๋ค ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ์๋๊ฐ? if event.type == pygame.QUIT : #์ฐฝ์ด ๋ซํ๋ ์ด๋ฒคํธ์ธ๊ฐ? running = False #๊ฒ์์ด ๋์ด์ ์คํ์ค์ด ์๋ #ํ๋ฉด ์ ์ฒด๋ฅผ ๊น๋งฃ๊ฒ ์น ํจ screen.fill(BLACK) #์์ ํ๋ฉด ํ์ display_start_screen() #ํ๋ฉด ์ ๋ฐ์ดํธ pygame.display.update() #๊ฒ์ ์ข ๋ฃ pygame.quit()
- start button click
import pygame
#์์ ํ๋ฉด ๋ณด์ฌ์ฃผ๊ธฐ
def display_start_screen() :
pygame.draw.circle(screen, WHITE, start_button.center, 60, 5) #ํฐ์ ์, ์ค์ฌ์ขํ start_button์ ์ค์ฌ์ขํ, ๋ฐ์ง๋ฆ 60, ๋๊ผ 5
#๊ฒ์ ํ๋ฉด ๋ณด์ฌ์ฃผ๊ธฐ
def display_game_screen():
print("Game Start")
#pos์ ํด๋นํ๋ ๋ฒํผ ํ์ธ
def check_buttons(pos):
global start #start ๋ณ์ ์ ์ญ๋ณ์๋ก ์ ์ธ
if start_button.collidepoint : #์ฌ๊ฐํ ์ ๋ณด ๋ด์์ pos ์์นํ๋์ง ํ์ธํ๋ ํจ์
start = True #display_game_screen() ์คํ
#์ด๊ธฐํ
pygame.init()
screen_width = 1280 #๊ฐ๋กํฌ๊ธฐ
screen_height = 720 #์ธ๋กํฌ๊ธฐ
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Memory Game")
#์์ ๋ฒํผ
start_button = pygame.Rect(0,0,120,120) #๊ฐ๋ก ์ธ๋ก 120
start_button.center = (120, screen_height-120 ) #x์ขํ,y์ขํ ๊ธฐ์ค์ผ๋ก ์ค์ฌ๊ฐ ์ค์
#์๊น
BLACK = (0,0,0) #RGB
WHITE = (255,255,255)
#๊ฒ์ ์์ ์ฌ๋ถ
start = False
#๊ฒ์ ๋ฃจํ
running = True #๊ฒ์์ด ์คํ์ค์ธ๊ฐ?ใ
while running :
click_pos = None
#์ด๋ฒคํธ ๋ฃจํ
for event in pygame.event.get(): #์ด๋ค ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ์๋๊ฐ?
if event.type == pygame.QUIT : #์ฐฝ์ด ๋ซํ๋ ์ด๋ฒคํธ์ธ๊ฐ?
running = False #๊ฒ์์ด ๋์ด์ ์คํ์ค์ด ์๋
elif event.type == pygame.MOUSEBUTTONUP : #์ฌ์ฉ์๊ฐ ๋ง์ฐ์ค๋ฅผ ํด๋ฆญํ์๋
click_pos = pygame.mouse.get_pos()
print(click_pos)
#ํ๋ฉด ์ ์ฒด๋ฅผ ๊น๋งฃ๊ฒ ์น ํจ
screen.fill(BLACK)
if start :
display_game_screen() #๊ฒ์ ํ๋ฉด ํ์
else :
display_start_screen() #์์ ํ๋ฉด ํ์
#์ฌ์ฉ์๊ฐ ํด๋ฆญํ ์ขํ๊ฐ์ด ์๋ค๋ฉด (์ด๋๊ฐ ํด๋ฆญํ๋ค๋ฉด)
if click_pos :
check_buttons(click_pos)
#ํ๋ฉด ์
๋ฐ์ดํธ
pygame.display.update()
#๊ฒ์ ์ข
๋ฃ
pygame.quit()
- game screen
- number_count = (level//3)+5 #//:๋ชซ
- number_count = min(number_count, 20) #์ซ์ ์ต๋๊ฐ 20level number_count
- 5 row (5๊ฐ์ ๋ฆฌ์คํธ), 9 column → 2์ฐจ์ ๋ฐฐ์ด
- grid = [[0 for col in range(columns)] for row in range(rows)]
- [[0,0,0,0,0,0,0,0,0],…,[0,0,0,0,0,0,0,0,0]]
import pygame
from random import *
#๋ ๋ฒจ์ ๋ง๊ฒ ์ค์
def setup(level) :
#์ผ๋ง๋ ๋ง์ ์ซ์๋ฅผ ๋ณด์ฌ์ค ๊ฒ์ธ๊ฐ?
number_count = (level // 3) + 5 # //:๋ชซ
number_count = min(number_count, 20) #๋ง์ฝ 20์ ์ด๊ณผํ๋ฉด 20์ผ๋ก ์ฒ๋ฆฌ
#์ค์ ํ๋ฉด์ gridํํ๋ก ์ซ์๋ฅผ ๋๋ค์ผ๋ก ๋ฐฐ์น
shuffle_grid(number_count)
#์ซ์ ์๊ธฐ(์ด ํ๋ก์ ํธ์์ ๊ฐ์ฅ ์ค์)
def shuffle_grid(number_count) :
rows = 5
columns = 9
# [[0, 0, 0, 0, 0, 0, 0, 0, 0],
# [0, 0, 5, 0, 0, 0, 0, 3, 0],
# [0, 0, 0, 1, 0, 0, 0, 0, 0],
# [0, 4, 0, 0, 0, 2, 0, 0, 0],
# [0, 0, 0, 0, 0, 0, 0, 0, 0]]
grid = [[0 for col in range(columns)] for row in range(rows)] #5 x 9
number = 1 #์์ ์ซ์ 1๋ถํฐ number_count๊น์ง, ๋ง์ฝ 5๋ผ๋ฉด 5๊น์ง ์ซ์๋ฅผ ๋๋ค์ผ๋ก ๋ฐฐ์น
while number <= number_count :
row_idx = randrange(0, rows) #0~5 ์ค์์ ๋๋ค์ผ๋ก ๋ฝ๊ธฐ
col_idx = randrange(0, columns) #0~8 ์ค์์ ๋๋ค์ผ๋ก ๋ฝ๊ธฐ
if grid[row_idx][col_idx] == 0 :
grid[row_idx][col_idx] = number #์ซ์ ์ง์
number += 1
#๋ฐฐ์น๋ ๋๋ค ์ซ์ ํ์ธ
print(grid)
#์์ ํ๋ฉด ๋ณด์ฌ์ฃผ๊ธฐ
def display_start_screen() :
pygame.draw.circle(screen, WHITE, start_button.center, 60, 5) #ํฐ์ ์, ์ค์ฌ์ขํ start_button์ ์ค์ฌ์ขํ, ๋ฐ์ง๋ฆ 60, ๋๊ผ 5
#๊ฒ์ ํ๋ฉด ๋ณด์ฌ์ฃผ๊ธฐ
def display_game_screen():
print("Game Start")
#pos์ ํด๋นํ๋ ๋ฒํผ ํ์ธ
def check_buttons(pos):
global start #start ๋ณ์ ์ ์ญ๋ณ์๋ก ์ ์ธ
if start_button.collidepoint : #์ฌ๊ฐํ ์ ๋ณด ๋ด์์ pos ์์นํ๋์ง ํ์ธํ๋ ํจ์
start = True #display_game_screen() ์คํ
#์ด๊ธฐํ
pygame.init()
screen_width = 1280 #๊ฐ๋กํฌ๊ธฐ
screen_height = 720 #์ธ๋กํฌ๊ธฐ
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Memory Game")
#์์ ๋ฒํผ
start_button = pygame.Rect(0,0,120,120) #๊ฐ๋ก ์ธ๋ก 120
start_button.center = (120, screen_height-120 ) #x์ขํ,y์ขํ ๊ธฐ์ค์ผ๋ก ์ค์ฌ๊ฐ ์ค์
#์๊น
BLACK = (0,0,0) #RGB
WHITE = (255,255,255)
#๊ฒ์ ์์ ์ฌ๋ถ
start = False
#๊ฒ์ ์์ ์ ์ ๊ฒ์ ์ค์ ํจ์ ์ํ
setup(1)
#๊ฒ์ ๋ฃจํ
running = True #๊ฒ์์ด ์คํ์ค์ธ๊ฐ?ใ
while running :
click_pos = None
#์ด๋ฒคํธ ๋ฃจํ
for event in pygame.event.get(): #์ด๋ค ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ์๋๊ฐ?
if event.type == pygame.QUIT : #์ฐฝ์ด ๋ซํ๋ ์ด๋ฒคํธ์ธ๊ฐ?
running = False #๊ฒ์์ด ๋์ด์ ์คํ์ค์ด ์๋
elif event.type == pygame.MOUSEBUTTONUP : #์ฌ์ฉ์๊ฐ ๋ง์ฐ์ค๋ฅผ ํด๋ฆญํ์๋
click_pos = pygame.mouse.get_pos()
print(click_pos)
#ํ๋ฉด ์ ์ฒด๋ฅผ ๊น๋งฃ๊ฒ ์น ํจ
screen.fill(BLACK)
if start :
display_game_screen() #๊ฒ์ ํ๋ฉด ํ์
else :
display_start_screen() #์์ ํ๋ฉด ํ์
#์ฌ์ฉ์๊ฐ ํด๋ฆญํ ์ขํ๊ฐ์ด ์๋ค๋ฉด (์ด๋๊ฐ ํด๋ฆญํ๋ค๋ฉด)
if click_pos :
check_buttons(click_pos)
#ํ๋ฉด ์
๋ฐ์ดํธ
pygame.display.update()
#๊ฒ์ ์ข
๋ฃ
pygame.quit()
- ๊ฒฉ์
- cell_size = 130
- button_size = 110
- screen_left_margin = 55
- screen_top_margin = 20
- ๊ฐ ์
์ ์ค๊ฐ ์ขํ๊ฐ :
- center_x = screen_left_margin + (col_indexcell_size) + (cell_size/2)
- center_y = screen_top_margin + (row_idxcell_size) + (cell_size/2)
- ์ซ์ ์จ๊ธฐ๊ธฐ
- ์๊ฐ ์ด๊ณผ
- display_time = 5 - (level//3)
- display_time = max(display_time, 1)level display_time - 1 ํด๋ฆญ
[(x1,y1)…(x6,y6)] click→๋ฒํผ ์์ ์ค
(x1,y1) ๋ฆฌ์คํธ์์ ๋นผ๊ธฐ ์์๋๋ก ํด๋ฆญํด์ผํจ. ๊ทธ๋ ์ง ์์ผ๋ฉด ๊ฒ์์ข ๋ฃ
- ์๊ฐ ์ด๊ณผ
- setup
- list ๊ณต๋ฐฑ → next level
- ์ค์ → ๋น์ ๋ ๋ฒจ ๋ณด์ฌ์ค ํ ๊ฒ์ ์ข ๋ฃ
- ์ต์ข ์ฝ๋
import pygame
from random import *
#๋ ๋ฒจ์ ๋ง๊ฒ ์ค์
def setup(level) :
#์ผ๋ง๋์ ์ซ์๋ฅผ ๋ณด์ฌ์ค ์ง
global display_time
display_time = 5 - (level//3)
display_time = max(display_time, 1) #1์ด ๋ฏธ๋ง์ด๋ฉด 1์ด๋ก ์ฐจ์ด
#์ผ๋ง๋ ๋ง์ ์ซ์๋ฅผ ๋ณด์ฌ์ค ๊ฒ์ธ๊ฐ?
number_count = (level // 3) + 5 # //:๋ชซ
number_count = min(number_count, 20) #๋ง์ฝ 20์ ์ด๊ณผํ๋ฉด 20์ผ๋ก ์ฒ๋ฆฌ
#์ค์ ํ๋ฉด์ gridํํ๋ก ์ซ์๋ฅผ ๋๋ค์ผ๋ก ๋ฐฐ์น
shuffle_grid(number_count)
#์ซ์ ์๊ธฐ(์ด ํ๋ก์ ํธ์์ ๊ฐ์ฅ ์ค์)
def shuffle_grid(number_count) :
rows = 5
columns = 9
cell_size = 130 #๊ฐ grid cell ๋ณ ๊ฐ๋ก, ์ธ๋ก ํฌ๊ธฐ
button_size = 110 #grid cell ๋ด์ ์ค์ ๋ก ๊ทธ๋ ค์ง ๋ฒํผ ํฌ๊ธฐ
screen_left_margin = 55 #์ ์ฒด ์คํฌ๋ฆฐ ์ผ์ชฝ ์ฌ๋ฐฑ
screen_top_margin = 20 #์ ์ฒด ์คํฌ๋ฆฐ ์์ชฝ ์ฌ๋ฐฑ
# [[0, 0, 0, 0, 0, 0, 0, 0, 0],
# [0, 0, 5, 0, 0, 0, 0, 3, 0],
# [0, 0, 0, 1, 0, 0, 0, 0, 0],
# [0, 4, 0, 0, 0, 2, 0, 0, 0],
# [0, 0, 0, 0, 0, 0, 0, 0, 0]]
grid = [[0 for col in range(columns)] for row in range(rows)] #5 x 9
number = 1 #์์ ์ซ์ 1๋ถํฐ number_count๊น์ง, ๋ง์ฝ 5๋ผ๋ฉด 5๊น์ง ์ซ์๋ฅผ ๋๋ค์ผ๋ก ๋ฐฐ์น
while number <= number_count :
row_idx = randrange(0, rows) #0~5 ์ค์์ ๋๋ค์ผ๋ก ๋ฝ๊ธฐ
col_idx = randrange(0, columns) #0~8 ์ค์์ ๋๋ค์ผ๋ก ๋ฝ๊ธฐ
if grid[row_idx][col_idx] == 0 :
grid[row_idx][col_idx] = number #์ซ์ ์ง์
number += 1
#ํ์ฌ grid cell ์์น ๊ธฐ์ค์ผ๋ก x,y ์์น๋ฅผ ๊ตฌํจ
center_x = screen_left_margin + (col_idx * cell_size) + (cell_size/2)
center_y = screen_top_margin + (row_idx * cell_size) + (cell_size/2)
#์ซ์ ๋ฒํผ ๋ง๋ค๊ธฐ
button = pygame.Rect(0,0,button_size, button_size)
button.center = (center_x,center_y)
number_buttons.append(button)
#๋ฐฐ์น๋ ๋๋ค ์ซ์ ํ์ธ
print(grid)
#์์ ํ๋ฉด ๋ณด์ฌ์ฃผ๊ธฐ
def display_start_screen() :
pygame.draw.circle(screen, WHITE, start_button.center, 60, 5)
#ํฐ์ ์, ์ค์ฌ์ขํ start_button์ ์ค์ฌ์ขํ, ๋ฐ์ง๋ฆ 60, ๋๊ผ 5
msg = game_font.render(f"{curr_level}", True, WHITE)
msg_rect = msg.get_rect(center=start_button.center)
screen.blit(msg, msg_rect)
#๊ฒ์ ํ๋ฉด ๋ณด์ฌ์ฃผ๊ธฐ
def display_game_screen():
global hidden
if not hidden :
elapsed_time = (pygame.time.get_ticks() - start_ticks) / 1000 #ms->sec
if elapsed_time > display_time :
hidden = True
for idx, rect in enumerate(number_buttons, start=1) : #๋ฆฌ์คํธ ๊ฐ ๊ฐ์ ธ์ค๊ณ ๊ฐ์ rect์ ์ง์ด๋ฃ๊ณ ์ธ๋ฑ์ค idx์ ์ง์ด๋ฃ์
if hidden: #์จ๊น ์ฒ๋ฆฌ
#๋ฒํผ ์ฌ๊ฐํ ๊ทธ๋ฆฌ๊ธฐ
pygame.draw.rect(screen, WHITE, rect)
else :
#์ค์ ์ซ์ ํ
์คํธ
cell_text = game_font.render(str(idx), True, WHITE)
text_rect = cell_text.get_rect(center=rect.center)
screen.blit(cell_text, text_rect)
#pos์ ํด๋นํ๋ ๋ฒํผ ํ์ธ
def check_buttons(pos):
global start, start_ticks #start ๋ณ์ ์ ์ญ๋ณ์๋ก ์ ์ธ
if start : #๊ฒ์์ด ์์ํ์ผ๋ฉด?
check_number_buttons(pos)
elif start_button.collidepoint(pos) : #์ฌ๊ฐํ ์ ๋ณด ๋ด์์ pos ์์นํ๋์ง ํ์ธํ๋ ํจ์
start = True #display_game_screen() ์คํ
start_ticks = pygame.time.get_ticks() #ํ์ด๋จธ ์์(ํ์ฌ ์๊ฐ์ ์ ์ฅ)
def check_number_buttons(pos) :
global hidden, start, curr_level #hidden์ ์ ์ญ๊ณต๊ฐ, hidden์ ๊ฐ ๋ฃ๊ธฐ ์ํด global -> ์ ์ญ๊ณต๊ฐ์ ์๋ ๋ณ์ ์ธ๊ฑฐ๋ผ๋ ๊ฒ ๋ช
์
for button in number_buttons:
if button.collidepoint(pos) :
if button == number_buttons[0]: #์ฌ๋ฐ๋ฅธ ์ซ์ ํด๋ฆญ
print("Correct")
del number_buttons[0] #์ฒซ๋ฒ์งธ ์์น ์ง์ฐ๊ธฐ
if not hidden :
hidden = True #์ซ์ ์จ๊น ์ฒ๋ฆฌ
else : #์๋ชป๋ ์ซ์ ํด๋ฆญ
game_over()
print("Wrong")
break
#๋ชจ๋ ์ซ์๋ฅผ ๋ค ๋ง์ถค -> ๋ ๋ฒจ ๋์ฌ์ ๋ค์ ์์ํ๋ฉด์ผ๋ก
if len(number_buttons) == 0:
start = False
hidden = False
curr_level += 1
setup(curr_level)
#๊ฒ์ ์ข
๋ฃ ์ฒ๋ฆฌ. ๋ฉ์์ง๋ ๋ณด์ฌ์ค
def game_over():
global running
running = False
msg = game_font.render(f"Your level is {curr_level}", True, WHITE)
msg_rect = msg.get_rect(center=(screen_width/2, screen_height/2))
screen.fill(BLACK)
screen.blit(msg, msg_rect)
#์ด๊ธฐํ
pygame.init()
screen_width = 1280 #๊ฐ๋กํฌ๊ธฐ
screen_height = 720 #์ธ๋กํฌ๊ธฐ
screen = pygame.display.set_mode((screen_width, screen_height))
pygame.display.set_caption("Memory Game")
game_font = pygame.font.Font(None, 120) #ํฐํธ ์ ์
#์์ ๋ฒํผ
start_button = pygame.Rect(0,0,120,120) #๊ฐ๋ก ์ธ๋ก 120
start_button.center = (120, screen_height-120 ) #x์ขํ,y์ขํ ๊ธฐ์ค์ผ๋ก ์ค์ฌ๊ฐ ์ค์
#์๊น
BLACK = (0,0,0) #RGB
WHITE = (255,255,255)
GRAY = (50, 50, 50)
number_buttons = [] #ํ๋ ์ด์ด๊ฐ ๋๋ฌ์ผ ํ๋ ๋ฒํผ๋ค
curr_level = 1 #ํ์ฌ ๋ ๋ฒจ
display_time = None #์ซ์๋ฅผ ๋ณด์ฌ์ฃผ๋ ์๊ฐ
start_ticks = None #์๊ฐ ๊ณ์ฐ (ํ์ฌ ์๊ฐ ์ ๋ณด๋ฅผ ์ ์ฅ)
#๊ฒ์ ์์ ์ฌ๋ถ
start = False
#์ซ์ ์จ๊น ์ฌ๋ถ(์ฌ์ฉ์๊ฐ 1์ ํด๋ฆญ ํ๊ฑฐ๋, ๋ณด์ฌ์ฃผ๋ ์๊ฐ ์ด๊ณผํ์ ๋)
hidden = False
#๊ฒ์ ์์ ์ ์ ๊ฒ์ ์ค์ ํจ์ ์ํ
setup(curr_level)
#๊ฒ์ ๋ฃจํ
running = True #๊ฒ์์ด ์คํ์ค์ธ๊ฐ?ใ
while running :
click_pos = None
#์ด๋ฒคํธ ๋ฃจํ
for event in pygame.event.get(): #์ด๋ค ์ด๋ฒคํธ๊ฐ ๋ฐ์ํ์๋๊ฐ?
if event.type == pygame.QUIT : #์ฐฝ์ด ๋ซํ๋ ์ด๋ฒคํธ์ธ๊ฐ?
running = False #๊ฒ์์ด ๋์ด์ ์คํ์ค์ด ์๋
elif event.type == pygame.MOUSEBUTTONUP : #์ฌ์ฉ์๊ฐ ๋ง์ฐ์ค๋ฅผ ํด๋ฆญํ์๋
click_pos = pygame.mouse.get_pos()
print(click_pos)
#ํ๋ฉด ์ ์ฒด๋ฅผ ๊น๋งฃ๊ฒ ์น ํจ
screen.fill(BLACK)
if start :
display_game_screen() #๊ฒ์ ํ๋ฉด ํ์
else :
display_start_screen() #์์ ํ๋ฉด ํ์
#์ฌ์ฉ์๊ฐ ํด๋ฆญํ ์ขํ๊ฐ์ด ์๋ค๋ฉด (์ด๋๊ฐ ํด๋ฆญํ๋ค๋ฉด)
if click_pos :
check_buttons(click_pos)
#ํ๋ฉด ์
๋ฐ์ดํธ
pygame.display.update()
#5์ด์ ๋ ๋ณด์ฌ์ฃผ๋ ์ญํ
pygame.time.delay(5000)
#๊ฒ์ ์ข
๋ฃ
pygame.quit()
์ถ์ฒ : https://www.youtube.com/watch?v=Qsk-xsi73YA&list=PLMsa_0kAjjrdqJ1rJba9MFWYv-GHluK4_&index=6
'์ฝ๋ฉ ํ ์คํธ > ํ์ด์ฌ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค ํ์ด์ฌ] ๋จ๊ณ๋ณ๋ก ํ์ด๋ณด๊ธฐ - Lv6. ์ฌํ 1 (0) | 2023.06.03 |
---|---|
[๋ฐฑ์ค ํ์ด์ฌ] ๋จ๊ณ๋ณ๋ก ํ์ด๋ณด๊ธฐ - Lv5.๋ฌธ์์ด (0) | 2023.05.27 |
[๋ฐฑ์ค ํ์ด์ฌ] ๋จ๊ณ๋ณ๋ก ํ์ด๋ณด๊ธฐ - Lv4. 1์ฐจ์ ๋ฐฐ์ด (1) | 2023.05.08 |
[๋ฐฑ์ค ํ์ด์ฌ] ๋จ๊ณ๋ณ๋ก ํ์ด๋ณด๊ธฐ - Lv3.๋ฐ๋ณต๋ฌธ (0) | 2023.04.11 |
[๋ฐฑ์ค ํ์ด์ฌ] ๋จ๊ณ๋ณ๋ก ํ์ด๋ณด๊ธฐ - Lv2.์กฐ๊ฑด๋ฌธ (0) | 2023.04.04 |