나는 파이 게임에 익숙하지 않으며 캐릭터로 새를 사용하는 사이드 스크롤링 게임을 만들고 있지만 화면에서 위아래로 움직이기 위해 노력하고 있지만 그림을 그릴 수는 없다. 어떻게. 당신이 버튼을 누를 경우사이드 스크롤링 게임
import pygame
from pygame.locals import *
import os
import sys
import time
pygame.init()
class Fly:
def __init__(self):
self.last_update = time.clock()
self.screen = pygame.display.set_mode((700, 400), 0, 32)
#Load bird
self.bird_state = 1
self.bird_frames = []
for r in xrange(1, 5):
self.bird_frames.append(pygame.image.load('bird%s.png' % r))
self.bg = pygame.image.load('bg.png').convert()
self.Loop()
def eventLoop(self):
'Take and process input from perephirals'
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()
def Update(self):
self.bird_state += 1
if self.bird_state > 4:
self.bird_state = 1
def Draw(self):
self.screen.blit(self.bg, [0, 0])
self.screen.blit(self.bird_frames[self.bird_state - 1], (150, 150))
def Loop(self):
while 1:
self.eventLoop()
if time.clock() - self.last_update > 0.15:
self.Update()
self.last_update = time.clock()
self.Draw()
pygame.display.update()
Fly()
당신이 당신의 질문에 대해 더 명확 할 수있다, 당신이 요법은 –