메뉴 건너뛰기

OBG

Programming

Python
2013.11.08 13:04

고양이 움직이기

MoA
조회 수 862 추천 수 0 댓글 1
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄 첨부

분석은 스스로

 

import pygame, sys
from pygame.locals import *

pygame.init()

FPS = 30 # frames per second setting
fpsClock = pygame.time.Clock()

# set up the window
DISPLAYSURF = pygame.display.set_mode((400, 300), 0, 32)
pygame.display.set_caption('Animation')

WHITE = (255, 255, 255)
catImg = pygame.image.load("cat.png")
catx = 10
caty = 10

while True: # the main game loop
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
        elif event.type == KEYDOWN and event.key == K_RIGHT:
            catx += 5
        elif event.type == KEYDOWN and event.key == K_LEFT:
            catx -= 5
        elif event.type == KEYDOWN and event.key == K_DOWN:
            caty += 5
        elif event.type == KEYDOWN and event.key == K_UP:
            caty -= 5

    DISPLAYSURF.fill(WHITE)
    DISPLAYSURF.blit(catImg, (catx, caty))

    pygame.display.update()
    fpsClock.tick(FPS)


?

  1. Programming 게시판 관련

  2. WTL 정리

  3. XML 파싱하기

  4. 강화학습 학습 관련 정리

  5. 개발에 도움되는 사이트 (초보 개발자 꿀팁)

  6. 개발자를 위한 각 기업 오픈소스 공유 사이트 (주로 모바일)

  7. 검색엔진 개발자 그룹

  8. 고수가 절대 알려주지 않는 C/C++ 팁

  9. 고양이 밖으로 못나가게 하기

  10. 고양이 움직이기

  11. 구글 검색 알고리즘의 원리

  12. 내 마음대로 선정한 머신러닝/딥러닝 학습 추천 서적

  13. 다국어를 위한 StringTable, LoadString

  14. 다른 스레드에서 메인다이얼로그 포인터 받아오기 AfxGetMainWnd()

  15. 다이얼로그 resize 시 child control의 그래픽 깨짐 해결

  16. 다이얼로그 기반에서 메뉴 내용이 갱신 안되는 문제 해결

  17. 동적 프로그래밍

  18. 디자인 패턴 정리

  19. 로그 클래스 및 업데이터

  20. 리스트 컨트롤 클릭 이벤트

  21. 리스트 컨트롤에 체크박스 추가

Board Pagination Prev 1 ... 6 7 8 9 10 11 12 13 14 ... 15 Next
/ 15
위로