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 = 1
dy = 1

black = (0,0,0)
white = (255,255,255)
yellow = (255,255,0)

pygame.init()
pygame.display.set_caption("JMJS Python class: bounce_j1")
screen = pygame.display.set_mode((640,480))

clock = pygame.time.Clock()
while 1:
    clock.tick(30)

    for event in pygame.event.get():
        if event.type == 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()

게시물: 28 건, 현재: 1 / 1 쪽
[1]
번호 제       목 작성자 등록일 방문
29  ocr cv2 py jinsung 21.9.17 6
28  PIL to numpy jinsung 21.9.15 6
27  pygame.display.flip vs pygame.display.update jinsung 21.9.6 11
26  house.py jinsung 21.3.18 124
25  move_circle_j1.py jinsung 21.3.18 97
24  bounce_j1.py jinsung 21.3.18 91
23  모두의 파이썬 - 20일만에배우는 프로그래밍 기초 JMJS 20.1.8 267
22  python -m pip install -U pip JMJS 19.11.25 231
21  get =lambda i,m ... JMJS 19.11.13 239
20  2차원 리스트, 튜플 JMJS 19.11.13 252
19  [turtle]def polygon3(n,c,d) JMJS 19.11.11 228
18  [turtle]def polygon2(n,a) JMJS 19.11.11 234
17  def factorial(n) JMJS 19.11.11 217
16  def sum_func(n) JMJS 19.11.11 261
15  def hello() fun1(a) fun2(a,b) JMJS 19.11.11 250
14  while sum JMJS 19.11.11 211
13  random calculation JMJS 19.11.11 223
12  turtle random JMJS 19.11.11 227
11  import time time.time JMJS 19.11.11 237
10  turtle begin_fill end_fill JMJS 19.11.11 215
9  if else JMJS 19.11.11 220
8  input JMJS 19.11.11 228
7  list JMJS 19.11.11 242
6  turtle triangle JMJS 19.11.11 228
5  for range JMJS 19.11.11 214
4  모듈 사용하기 JMJS 19.11.11 230
3  import 파이썬 모듈 가져다 쓰기 JMJS 19.11.11 246
1  print 줄바꿈 JMJS 19.11.11 276
[1]