当我运行我的程序时,它不会用白色填充屏幕,我应该这样想(IM NEW)。我检查iv写的其他游戏,我似乎做同样的东西,但它适用于其他的?这是我的计划:
import pygame,time,pygame.mixer
from pygame.locals import *
pygame.init()
#set screen to be the window
screen=pygame.display.set_mode((640,480))
#fills screen with white
screen.fill((255,255,255))
#set starting gravity
gravity=0.1
#limits fps
FPS=60
fpstime=pygame.time.Clock()
timer=0
#sets colour codes
red=(255,0,0)
green=(0,255,0)
blue=(0,255,0)
white=(255,255,255)
#set player starting location
playerpos1=320
playerpos2=240
#makes the game loop start
FLYING=True
#game loop
while FLYING:
screen.fill((255,255,255))
gravity+=0.02
timer+=0.001
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
break
pygame.display.update
fpstime.tick(FPS)
答案 0 :(得分:0)
一个可能的问题 - 您在()
上遗漏了pygame.display.update()
。