OGG音乐导致其他游戏"游戏"无法加载,导致进程中没有响应错误

时间:2016-07-02 13:43:37

标签: python python-2.7 pygame panda3d

基本上,我正在尝试使用Panda3D 1.9.2,Python 2.7.12和pygame 1.9.1,并且我试图通过整合Toontown Rewritten和迪士尼的Toontown Online资产进行实验来尝试创建随机的东西,看看我可以得到它。我是用Python编写的全新的Panda3D& pygame所以我不确定我做错了什么。我的代码是:

from direct.actor.Actor import Actor
from pandac.PandaModules import *
from direct.task import Task
import math
from math import pi, sin, cos
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.interval.IntervalGlobal import Sequence
from pandac.PandaModules import Point3
from pandac.PandaModules import *
from panda3d.core import loadPrcFile

loadPrcFile("config.prc")

import direct.directbase.DirectStart
from panda3d.core import CollisionTraverser,CollisionNode
from panda3d.core import CollisionHandlerQueue,CollisionRay
from panda3d.core import Filename,AmbientLight,DirectionalLight
from panda3d.core import PandaNode, NodePath, Camera, TextNode
from panda3d.core import Vec3,Vec4,BitMask32
from direct.gui.OnscreenText import OnscreenText
from direct.actor.Actor import Actor
from direct.showbase.DirectObject import DirectObject
import pygame
pygame.init()
pygame.mixer.music.load('bgm.ogg')
pygame.mixer.music.play(-1, 0.0)
while pygame.mixer.music.get_busy() == True:
    continue

cog = Actor ('phase_3.5/models/char/suitA-mod.bam', {'action':'phase_4/models/char/suitA-neutral.bam'})
cog.loop('action')
cog.reparentTo(render)
cog.find('**/hands').setColor(0.95, 0.75, 0.75, 1.0)
#SELLBOT cog.find('**/hands').setColor(0.95, 0.75, 0.95, 1.0)
#CASHBOT cog.find('**/hands').setColor(0.65, 0.95, 0.85, 1.0)
#LAWBOT cog.find('**/hands').setColor(0.75, 0.75, 0.95, 1.0)
#BOSSBOT cog.find('**/hands').setColor(0.95, 0.75, 0.75, 1.0)
cog.setPos(0, 20, 0)

myTex = loader.loadTexture('phase_3.5/maps/c_blazer.jpg')
cog.findAllMatches('**/torso').setTexture(myTex, 1)
myTex2 = loader.loadTexture('phase_3.5/maps/c_leg.jpg')
cog.findAllMatches('**/legs').setTexture(myTex2, 1)
myTex3 = loader.loadTexture('phase_3.5/maps/c_sleeve.jpg')
cog.findAllMatches('**/arms').setTexture(myTex3, 1)

coghead = loader.loadModel('phase_4/models/char/suitA-heads.bam').find('**/yesman')
coghead.reparentTo(cog.find('**/joint_head'))

camera.hide()
base.oobe()
base.run()

此代码只会造成这种混乱:http://prntscr.com/bnvvae

我没有创建整个代码,而是修改了在线发布的某个人的示例。直到我实现OGG文件,它才停止正常工作。我还必须补充一点,音乐文件播放完全没问题,尽管该节目"没有响应"。

我不确定我做错了什么。有人可以帮帮我吗?

1 个答案:

答案 0 :(得分:0)

你不需要while循环删除这段代码:

while pygame.mixer.music.get_busy() == True:
    continue