所以我正在将声音加载到我的游戏中,但是我得到了这个错误,我正在使用python 3 windows 10。
pygame.error: mixer not initialized
我试过推杆,但当我推杆的时候
pygame.mixer.init()
当我放入pygame.mixer.init()时,我得到这个错误??我必须导入一些东西吗??
pygame.error: DirectSoundCreate: No audio device found
import pygame
import math
pygame.init()
pygame.mixer.init()
# window
按照Youtube上的一个在线游戏构建教程,我正在尝试构建一个游戏,但每当我输入这段代码时,它总是出现这个语法错误:
line 11, in <module>
icon = pygame.image.load('burger.png')
pygame.error: Couldn't open burger.png
我该怎么办?
我目前正在用Python2.7.7和Pygame编写一个游戏。我使用的是一台运行OSX10.9的苹果电脑,我使用的是Eclipse和PyDev插件。在游戏中,我加载了一个PNG文件作为游戏的背景。然而,每当我尝试时,它都会检测到该文件,但它给我一个错误:"pygame.error: file is not a Windows BMP file“。每当我以前使用Pygame时,我都可以很好地加载PNG文件。我还尝试将图像导出为JPG格式,但得到了相同的错误。请注意,我知道有类似的问题,然而,这些解决方案中的大多数只能在Windows上运行。我尝试运行"update Shell p
我的pygame代码
bif="images.jpg"
mif="point.png"
import pygame, sys
from pygame.locals import *
pygame.init()
screen=pygame.display.set_mode((640,360),0,32)
background=pygame.image.load(bif).convert()
mouse_c=pygame.image.load(mif).convert_alpha()
while True:
for event in pygame.
我正在尝试使用Py2app从python制作应用程序。当我运行命令行python3 setup.py py2app时。它运行成功,但当我不能打开我的独立,我得到一个错误说:
background = pygame.image.load('bg.png')
pygame.error: File is not a Windows BMP file
有人能给我指出如何解决这个问题吗?
ps:我使用的是Mac os Mojave 10.14.6,pygam2.0.0.dev6 (SDL 2.0.12,python 3.8.2)
我在ubuntu机器15.04上使用anaconda python 2.7。
我需要opencv,pygame,python2.7来运行我的代码。
我在运行我的代码时得到错误:
Traceback (most recent call last):
File "deep_q_network.py", line 8, in <module>
import wrapped_flappy_bird as game
File "game/wrapped_flappy_bird.py", line 19, in <module>
我的代码中有一个小问题。我有以下代码:
import os,pygame
class npc:
ntype = 0
image = None
x = 0
y = 0
text = ""
name = ""
def Draw(self,screen):
screen.blit(self.image, [self.x*32,self.y*32])
def __init__(self,name,nx,ny):
f = open(name)
z = 0