로그인

검색

Python
2013.11.08 13:04

고양이 움직이기

MoA
조회 수 11655 추천 수 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 Views100467
    read more
  2. What does set -e mean in a bash script?

    Date2021.04.29 CategoryTool/etc ByOBG Views19133
    Read More
  3. What does the last “-” (hyphen) mean in options of `bash`?

    Date2021.04.29 CategoryTool/etc ByOBG Views19556
    Read More
  4. 2016년에 자바스크립트를 배우는 기분

    Date2016.12.27 CategoryTool/etc ByMoA Views9775
    Read More
  5. 서비스중인 게임 DB 설계(쿠키런) 기초

    Date2016.07.12 CategoryDatabase ByMoA Views9960
    Read More
  6. PHP: 잘못된 디자인의 프랙탈

    Date2016.07.10 CategorySite ByMoA Views11805
    Read More
  7. Windows 10 앱 개발(UWP)

    Date2015.10.13 CategoryAPI/MFC ByMoA Views21185
    Read More
  8. 정신나간 정렬 알고리즘

    Date2015.10.13 CategoryC/C++ ByMoA Views11658
    Read More
  9. 비트윈 PC 버전 개발기

    Date2015.10.11 CategorySite ByMoA Views12211
    Read More
  10. Machine Learning for Video Games

    Date2015.07.27 CategoryTool/etc ByMoA Views19557
    Read More
  11. [액션게임 만들기] 10. 캐릭터 기술 구현

    Date2014.05.07 CategoryPython ByMoA Views10912
    Read More
  12. [액션게임 만들기] 9. 캐릭터 액션 구현 2

    Date2014.05.07 CategoryPython ByMoA Views10756
    Read More
  13. [액션게임 만들기] 8. 캐릭터 액션 구현 1

    Date2014.05.07 CategoryPython ByMoA Views10522
    Read More
  14. [액션게임 만들기] 7. 캐릭터 출력

    Date2014.05.07 CategoryPython ByMoA Views10746
    Read More
  15. [액션게임 만들기] 6. 게임 화면 출력

    Date2014.05.07 CategoryPython ByMoA Views10797
    Read More
  16. [액션게임 만들기] 5. 장면 전환

    Date2014.05.07 CategoryPython ByMoA Views10787
    Read More
  17. [액션게임 만들기] 4. 캐릭터 선택 화면

    Date2014.05.07 CategoryPython ByOBG Views10935
    Read More
  18. [액션게임 만들기] 3. 클래스 다이어그램 기초

    Date2014.05.07 CategoryPython ByOBG Views14291
    Read More
  19. [액션게임 만들기] 2. 클래스 분석

    Date2014.05.06 CategoryPython ByOBG Views11351
    Read More
  20. [액션게임 만들기] 1. Street Pyghter 게임 소개

    Date2014.05.03 CategoryPython ByOBG Views11329
    Read More
  21. [농장게임 만들기] 10. 상점을 추가하자

    Date2014.05.01 CategoryPython ByMoA Views12516
    Read More
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 ... 17 Next
/ 17