I’m currently working on a game that requires cutscenes (playing movie textures). I managed to play both the movie texture along with the audio synchronized to the movie. Once after the cutscene is finished, I used a task function to remove the card (node path) used to display the movie. However, when I retrigger the cutscene that requires the software to play the same movie texture again, the application stops responding, as though it had enter an infinite loop or something.
I introduce the movie texture in the init function:
self.movieE=loader.loadTexture("Movies/goingup.avi")
self.cmE = CardMaker("My Fullscreen Card")
self.cmE.setFrameFullscreenQuad()
self.cmE.setUvRange(self.movieE)
self.soundE=loader.loadSfx("Movies/goingup.avi")
self.movieE.synchronizeTo(self.soundE)
When the characters enter a trigger zone that triggers the cutscene, I introduce a nodepath to display the movie texture, and I play the movie:
self.cardE = NodePath(self.cmE.generate())
self.cardE.reparentTo(render2d)
self.cardE.setTexture(self.movieE)
self.soundE.play()
After the trigger event finishes playing (using a task function), I remove the card texture:
if self.soundE.getTime()<=5:
print task.time
return Task.cont
if self.soundE.getTime()>=5:
self.movieE.clear()
self.cardE.remove()
self.collide=0
self.escalator=0
return Task.done
It works perfectly fine till this stage. However, when I tried to retrigger this cutscene using the same function (which is necessary), the application stop responding.
self.cardE = NodePath(self.cmE.generate())
self.cardE.reparentTo(render2d)
self.cardE.setTexture(self.movieE)
self.soundE.play()
Would gladly appreciate any help on this problem. Thanks!