我正在创建一个名为“生存岛”的游戏,并且刚刚创建了开始屏幕。pygame 在执行一个事件后滞后太多(需要时间来响应)。
这是我的源代码:
#packages
import pygame
import sys
from sys import exit
#initialization
pygame.init()
#display surf
width = 600
height = 400
surface = pygame.display.set_mode((width,height))
clock = pygame.time.Clock()#for fps
#caption
pygame.display.set_caption('Survival Island')
#variables
mousex = 0
mousey = 0
#booleans
play = True #entered playmode
canQuitOnStart = True #game can be quitted on start
drawStartScreen = True #start screen drawed
running = True # game is running
#definitions
def quitOnStart(): #quitting the game
#can be seen if rect is drawn …Run Code Online (Sandbox Code Playgroud)