LogIn E-mail
¼³°èÀ̾߱â
bounce_j1.py
# 24 jinsung    70.1.1 09:00

import pygame
import sys

WIDTH=640
HEIGHT=480

x = 163
y = 120
dx = 10
dy = 10

BLACK = (0,0,0)
WHITE = (255,255,255)

pygame.init()
screen = pygame.display.set_mode((WIDTH,HEIGHT))
clock = pygame.time.Clock()
while True:
    clock.tick(10)

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()

    x += dx
    y += dy

    if x < 0 or x > WIDTH:  
        dx = -dx

    if y < 0 or y > HEIGHT:
        dy = -dy

    screen.fill(BLACK)

    pygame.draw.circle(screen, WHITE, (x,y), 8)

    pygame.display.flip()

°Ô½Ã¹°: 33 °Ç, ÇöÀç: 1 / 1 ÂÊ
[1]
¹øÈ£ Á¦       ¸ñ ÀÛ¼ºÀÚ µî·ÏÀÏ ¹æ¹®
34  sys.argv jinsung 22.4.1 39
33  args kwargs jinsung 22.4.1 40
32  set ÁýÇÕ jinsung 22.3.24 39
31  getopt - ¸í¿­ ÁÙ ¿É¼Ç¿ë c ½ºÅ¸ÀÏ ±¸¹® JMJS 22.4.1 72
30  tuple Àº ¼öÁ¤ ¸øÇÔ jinsung 21.11.6 108
29  ocr cv2 py jinsung 21.9.17 146
28  PIL to numpy jinsung 21.9.15 140
27  pygame.display.flip vs pygame.display.update jinsung 21.9.6 173
26  house.py jinsung 21.3.18 290
25  move_circle_j1.py jinsung 21.3.18 238
24  bounce_j1.py jinsung 22.2.15 234
23  ¸ðµÎÀÇ ÆÄÀ̽ã - 20Àϸ¸¿¡¹è¿ì´Â ÇÁ·Î±×·¡¹Ö ±âÃÊ JMJS 20.1.8 416
22  python -m pip install -U pip , matplotlib arcade ... jinsung 22.4.15 343
21  get =lambda i,m ... JMJS 19.11.13 340
20  2Â÷¿ø ¸®½ºÆ®, Æ©Çà jinsung 21.11.6 358
19  [turtle]def polygon3(n,c,d) JMJS 19.11.11 337
18  [turtle]def polygon2(n,a) JMJS 19.11.11 333
17  def factorial(n) JMJS 19.11.11 302
16  def sum_func(n) JMJS 19.11.11 350
15  def hello() fun1(a) fun2(a,b) JMJS 19.11.11 333
14  while sum JMJS 19.11.11 294
13  random calculation JMJS 19.11.11 309
12  turtle random JMJS 19.11.11 313
11  import time time.time JMJS 19.11.11 314
10  turtle begin_fill end_fill JMJS 19.11.11 306
9  if else JMJS 19.11.11 298
8  input JMJS 19.11.11 310
7  list JMJS 19.11.11 322
6  turtle triangle JMJS 19.11.11 309
5  for range JMJS 19.11.11 304
4  ¸ðµâ »ç¿ëÇϱâ JMJS 19.11.11 312
3  import ÆÄÀ̽㠸ðµâ °¡Á®´Ù ¾²±â JMJS 19.11.11 331
1  print ÁÙ¹Ù²Þ JMJS 19.11.11 370
[1]