我刚开始用Pygame和Pycharm编写我的第一个游戏。我试图在下面的代码中加载背景图像,但出现了一个错误
import os
import pygame
import pygame.locals
#objects (classes, functions)
#setup (run-once code)
worldx = 960
worldy = 720
fps = 40
ani = 4 #animation cycles
clock = pygame.time.Clock()
pygame.init()
world = pygame.display.set_mode([worldx,worldy])
current_path = os.path.dirname(__file__)
image_path = os.path.join(current_path, 'images')
backdrop = pygame.image.load(os.path.join(image_path, 'stage.png'))
backdropbox = world.get_rect()
BLUE = (25,25,200)
BLACK = (23,23,23)
WHITE = (254,254,254)
#main loop (game loop)
这是错误消息:
pygame.error: Couldn't open C:/Users/Justus/PycharmProjects/Vulcanoreal_game.py\images\stage.png
谁能帮帮我吗?顺便说一句,我的英语不是最好的,对不起;)
进口:
您当前的路径应该是:
相关问题 更多 >
编程相关推荐