-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasic_code.py
More file actions
54 lines (37 loc) · 920 Bytes
/
basic_code.py
File metadata and controls
54 lines (37 loc) · 920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import pygame
# 게임 스크린 크기
SCREEN_WIDTH = 800
SCREEN_HEIGHT = 600
# RGB 값 색상 지정
Black = (0, 0, 0)
White = (255, 255, 255)
Red = (255, 0, 0)
Green = (0, 255, 0)
Blue = (0, 0, 255)
Pink = (255, 192, 203)
# 초기화
pygame.init()
# Window Name 설정
pygame.display.set_caption("My Game")
# Window 크기 정의
screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))
# Screen Update
clock = pygame.time.Clock()
# 게임 반복 구간
done = False
while not done: # While True
# Event 반복 구간
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
# 게임 로직 구간
# 화면 삭제 구간
# 스크린 채우기
screen.fill(White)
# 화면 그리기
# 화면 업데이트
pygame.display.flip()
# 초당 업데이트 횟수
clock.tick(60)
# 게임 종료
pygame.quit()