当我玩它时,Python 没有响应。也没有出现语法错误。不知道出了什么问题。我尝试运行我制作的另一款游戏,它运行良好,所以我认为它不是我的电脑。 错误信息
这是我的代码:
import pygame
pygame.init()
screen = pygame.display.set_mode((800,600))
pygame.display.set_caption("Draft")
icon = pygame.image.load("doctor.png")
pygame.display.set_icon(icon)
white = (255,255,255)
black = (0,0,0) red = (255,0,0)
green = (0,255,0)
blue = (0,0,255)
def draw_ground():
groundx = 20
groundy = 30
Ground = pygame.Rect(groundx,groundy,width = 800,height = 20)
pygame.draw.rect(screen,green,Ground)
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
draw_ground()
它还没有完成,我正在尝试在继续之前先对其进行测试。