【发布时间】:2014-04-16 18:38:45
【问题描述】:
我目前正在制作一个基本的 2D 平台游戏,到目前为止我所做的只是开始菜单的背景。但是当我运行时它不会运行我的游戏。偶尔它会运行它,一切都会显示出来,但是有一个黑色的块覆盖了窗口的一部分?
谁能解释这是为什么?
bif=("cloud.jpg")
import pygame,sys
from pygame.locals import *
pygame.init()
screen=pygame.display.set_mode((813,555),0,32)
pygame.display.set_caption('Red Dwarf')
background=pygame.image.load(bif).convert()
while True:
for event in pygame.event.get():
if event.type==QUIT:
pygame.quit()
sys.exit()
screen.blit(background,(0,0))
pygame.display.update()
【问题讨论】:
-
我的代码没有完整显示在这里,而是从 bif=("cloud.jpg") 开始。对不起
-
您是否尝试过在代码的各个阶段插入任何
print语句以查看发生了什么? -
“我目前正在制作一个基本的 2D 平台游戏,到目前为止我所做的只是开始菜单的背景”——这就是黄金!
标签: python 2d pygame python-idle