我想做一个游戏,现在我想显示一个欢迎屏幕5秒。我输入谷歌这个问题,并有很多结果,但没有任何工作。我看到这个问题已经在堆栈溢出之前被覆盖了,但是这对我不起作用。我试过time.sleep
,pygame.time.set
,pygame.time.tick
等等。这是我现在的代码,但之前我正在对其进行更改。这里是代码,并提前感谢。消息到屏幕将不会停止设定的时间后
#I imported all these mods just in case I need them, that way I don't have to worry about it
import math
import random
import time
import pygame
import cx_Freeze
import os
import superwires
import sys
import pip
import glob
from pygame import *
pygame.init()
move=0
FPS=60
blue=(0,0,255)
white=(255,255,255)
black=(0,0,0)
green=(0,155,0)
display_width=800
display_height=600
gamedisplay=pygame.display.set_mode((display_width,display_height))
pygame.display.set_caption('Stacker')
clock=pygame.time.Clock()
smallfont=pygame.font.SysFont("Arial",25)
mediumfont=pygame.font.SysFont("Arial",50)
largefont=pygame.font.SysFont("Arial",80)
gamedisplay.fill(green)
pygame.display.update()
def welcome_screen():
welcome_message = largefont.render(str("Welcome to Stacker!!!"), True,black)
gamedisplay.blit(welcome_message,(87,25))
pygame.display.update()
play=True
while play==True:
welcome_screen()
pygame.time.delay(5)
play=False
pygame.display.update()
pygame.display.update()
当发布代码的尝试,使[最小的完整工作示例(http://stackoverflow.com/help/mcve)尤其是你应该删除任何导入你不需要。 –