缩进错误:应为缩进块pygame pygame

2024-04-19 23:54:42 发布

您现在位置:Python中文网/ 问答频道 /正文

尝试使用pygame在pycharm中创建游戏,当我运行测试代码时,返回此错误消息

def game_initialize():

缩进错误:应为缩进块

import libtcodpy as libtcod
import pygame

#game files
import Constants

def game_mian_loop():

    game_quit = False

    while not game_quit:

        #Get player input

        #Process input

        #draw game

    #quit game

def game_initialize():

    global SURFACE_MAIN

    pygame.init()

    SURFACE_MAIN = pygame.display.set_mode( (Constants.GAME_WIDTH,Constants.GAME_HEIGHT ) )

Tags: importgame游戏inputmaindef错误surface
1条回答
网友
1楼 · 发布于 2024-04-19 23:54:42

在Python中循环不能为空。当您不想为测试目的而执行任何操作时,请使用pass

while not game_quit:
    pass

    #Get player input

    #Process input

    #draw game

相关问题 更多 >