我想做一個遊戲,現在我想顯示一個歡迎屏幕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)尤其是你應該刪除任何導入你不需要。 –