基本上,我正在尝试使用 Panda3D 1.9.2、Python 2.7.12 和 pygame 1.9.1,并且我正在尝试将 Toontown Rewritten 和 Disney 的 Toontown Online 资产放在一起,以尝试随机创建一些东西,看看我可以从哪里获得它。我对使用 Panda3D 和 pygame 在 Python 中编码是全新的,所以我完全不确定我做错了什么。我的代码是:
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 文件,它才停止正常工作。我还必须补充一点,尽管程序“没有响应”,但音乐文件播放得非常好。
我不确定我做错了什么。有人可以帮我吗?