所以,我正在制作两个非常相似的游戏(具体细节现在不重要)
不管怎样,我需要知道在哪里插入我的“pygame.time.等等“代码。你知道吗
我需要的确切代码如下所示:
pygame.time.wait(100)
score = score + 1
目前,我的代码如下所示:
import sys, pygame
from pygame.locals import *
pygame.init()
size = width, height = 800,500
screen = pygame.display.set_mode(size)
pygame.display.set_caption("One Score (Created by - Not Really Working Lamp Productions:)")
WHITE = (255,255,255)
score = 0
screen.fill (WHITE)
myfont = pygame.font.SysFont("monospace", 16)
scoretext = myfont.render("Score = "+str(score), 1, (0,0,0))
screen.blit(scoretext, (5, 10))
disclaimertext = myfont.render("Copyright, 2013, Not Really Working Lamp Productions.", 1, (0,0,0))
screen.blit(disclaimertext, (5, 480))
while 1:
for event in pygame.event.get():
pygame.display.flip()
if event.type == pygame.QUIT:sys.exit()
但问题是,我不知道在这段代码中我应该把我的pygame.time.等等代码。有人能告诉我吗?(我想它在“while1:”循环中,但我不知道在哪里。)
下午好。您应该将“等待代码”放入FOR循环的主体中:
相关问题 更多 >
编程相关推荐