로그인

검색

Python
2013.11.08 13:04

고양이 움직이기

MoA
조회 수 6946 추천 수 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 Views41403
    read more
  2. 비트윈 PC 버전 개발기

    Date2015.10.11 CategorySite ByMoA Views6779
    Read More
  3. Machine Learning for Video Games

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

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

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

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

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

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

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

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

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

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

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

    Date2014.05.01 CategoryPython ByMoA Views7621
    Read More
  15. [농장게임 만들기] 9. 밀을 재배하자

    Date2014.05.01 CategoryPython ByMoA Views6703
    Read More
  16. [농장게임 만들기] 8. HUD에 텍스트를 표시하자

    Date2014.05.01 CategoryPython ByMoA Views6477
    Read More
  17. [농장게임 만들기] 7. 농부 행동 추가

    Date2014.05.01 CategoryPython ByMoA Views6642
    Read More
  18. [농장게임 만들기] 6. 나머지 오브젝트를 그리자

    Date2014.05.01 CategoryPython ByMoA Views6885
    Read More
  19. [농장게임 만들기] 5. 플레이어를 추가하자

    Date2014.04.30 CategoryPython ByMoA Views6162
    Read More
  20. [농장게임 만들기] 4. 펜스를 그리자

    Date2014.04.30 CategoryPython ByMoA Views5598
    Read More
  21. [농장게임 만들기] 3. 배경을 그리자

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