로그인

검색

Python
2013.11.08 13:04

고양이 움직이기

MoA
조회 수 3444 추천 수 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 게시판 관련

    Date2014.11.01 CategoryTool/etc ByMoA Views15455
    read more
  2. 메시지 펌프

    Date2011.08.26 CategoryAPI/MFC By너울 Views3530
    Read More
  3. ofstream ifstream

    Date2013.07.28 CategoryC/C++ ByMoA Views3532
    Read More
  4. C++에서 base64로 인코딩

    Date2012.11.15 CategoryC/C++ ByNaya Views3534
    Read More
  5. 리스트 컨트롤 클릭 이벤트

    Date2013.06.12 CategoryAPI/MFC ByMoA Views3536
    Read More
  6. 유용한 라이브러리 소개

    Date2013.12.27 CategoryTool/etc ByMoA Views3540
    Read More
  7. [첫게임 만들기] 9. 사운드

    Date2013.11.21 CategoryPython ByMoA Views3542
    Read More
  8. 후킹 링크

    Date2013.07.28 CategoryAPI/MFC ByMoA Views3550
    Read More
  9. 화면 캡쳐 소스

    Date2014.01.14 CategoryPython ByMoA Views3553
    Read More
  10. 비트윈 PC 버전 개발기

    Date2015.10.11 CategorySite ByMoA Views3555
    Read More
  11. CPaneDialog의 context menu 안뜨게 하기

    Date2013.06.12 CategoryAPI/MFC ByMoA Views3559
    Read More
  12. 워게임 사이트 정리

    Date2014.01.27 CategoryReversing ByMoA Views3568
    Read More
  13. 특정 자료형의 데이터를 binary(hex값, 2진수값)으로 변환

    Date2012.11.15 CategorySite ByNaya Views3580
    Read More
  14. WTL 정리

    Date2013.12.22 CategoryAPI/MFC ByMoA Views3581
    Read More
  15. [농장게임 만들기] 9. 밀을 재배하자

    Date2014.05.01 CategoryPython ByMoA Views3586
    Read More
  16. Win32 Socket Class

    Date2012.08.02 CategoryLibrary ByNaya Views3594
    Read More
  17. HWND와 HINSTANCE

    Date2013.07.28 CategoryAPI/MFC ByMoA Views3607
    Read More
  18. CFile을 이용한 저장/불러오기

    Date2013.08.27 CategoryAPI/MFC ByMoA Views3622
    Read More
  19. [액션게임 만들기] 1. Street Pyghter 게임 소개

    Date2014.05.03 CategoryPython ByOBG Views3624
    Read More
  20. 다이얼로그 resize 시 child control의 그래픽 깨짐 해결

    Date2013.07.25 CategoryAPI/MFC ByMoA Views3631
    Read More
  21. [농장게임 만들기] 7. 농부 행동 추가

    Date2014.05.01 CategoryPython ByMoA Views3659
    Read More
Board Pagination Prev 1 ... 6 7 8 9 10 11 12 13 14 15 Next
/ 15