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

import pygame
import sys

width,height=640,480

white = (255, 255, 255)
black = (0, 0, 0)
pos_x = 200
pos_y = 200


pygame.init()
pygame.display.set_caption("Simple PyGame Example")
screen = pygame.display.set_mode((width,height))

clock = pygame.time.Clock()
while True:
    clock.tick(15)

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

    key_event = pygame.key.get_pressed()
    if key_event[pygame.K_LEFT]:
        pos_x -= 10

    if key_event[pygame.K_RIGHT]:
        pos_x += 10

    if key_event[pygame.K_UP]:
        pos_y -= 10

    if key_event[pygame.K_DOWN]:
        pos_y += 10


    screen.fill(black)

    pygame.draw.circle(screen, white, (pos_x, pos_y), 20)


    pygame.display.update()

°Ô½Ã¹°: 25 °Ç, ÇöÀç: 1 / 1 ÂÊ
[1]
¹øÈ£ Á¦       ¸ñ ÀÛ¼ºÀÚ µî·ÏÀÏ ¹æ¹®
26  house.py jinsung 21.3.18 21
25  move_circle_j1.py jinsung 21.3.18 12
24  bounce_j1.py jinsung 21.3.18 9
23  ¸ðµÎÀÇ ÆÄÀ̽ã - 20Àϸ¸¿¡¹è¿ì´Â ÇÁ·Î±×·¡¹Ö ±âÃÊ JMJS 20.1.8 176
22  python -m pip install -U pip JMJS 19.11.25 162
21  get =lambda i,m ... JMJS 19.11.13 174
20  2Â÷¿ø ¸®½ºÆ®, Æ©Çà JMJS 19.11.13 169
19  [turtle]def polygon3(n,c,d) JMJS 19.11.11 156
18  [turtle]def polygon2(n,a) JMJS 19.11.11 160
17  def factorial(n) JMJS 19.11.11 152
16  def sum_func(n) JMJS 19.11.11 164
15  def hello() fun1(a) fun2(a,b) JMJS 19.11.11 171
14  while sum JMJS 19.11.11 145
13  random calculation JMJS 19.11.11 150
12  turtle random JMJS 19.11.11 152
11  import time time.time JMJS 19.11.11 165
10  turtle begin_fill end_fill JMJS 19.11.11 156
9  if else JMJS 19.11.11 154
8  input JMJS 19.11.11 159
7  list JMJS 19.11.11 177
6  turtle triangle JMJS 19.11.11 163
5  for range JMJS 19.11.11 144
4  ¸ðµâ »ç¿ëÇϱâ JMJS 19.11.11 167
3  import ÆÄÀ̽㠸ðµâ °¡Á®´Ù ¾²±â JMJS 19.11.11 162
1  print ÁÙ¹Ù²Þ JMJS 19.11.11 201
[1]