to split the screen into two and defined movement between of the screens.
look this is my code
from math import pi, sin, cos
from direct.showbase.ShowBase import ShowBase
from direct.task import Task
from direct.actor.Actor import Actor
from direct.gui.OnscreenImage import OnscreenImage
from pandac.PandaModules import TransparencyAttrib
from direct.interval.IntervalGlobal import Sequence
from panda3d.core import Point3
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
imageObject = OnscreenImage(image = 'finel.png', pos = (0,0,0),parent=render2d)
base.cam.node().getDisplayRegion(0).setSort(20)
imageObject.setScale(1.1,0,2.2)
# Load and transform the panda actor.
self.pandaActor = Actor("StationWagon")
self.pandaActor.setScale(8, 8, 8)
self.pandaActor.reparentTo(self.render)
# Loop its animation.
self.pandaActor.loop("walk")
self.pandaActor.setHpr(180, 0, 0)
mySound = base.loader.loadSfx("test.ogg")
mySound.play()
mySound.setVolume(0)
def exampleTask(task):
k=self.pandaActor.getY()
print(k)
if k > 1840:
mySound.setVolume(0.1)
return task.cont
if 1380<k<1840:
mySound.setVolume(0.2)
return task.cont
if 920<k<1840:
mySound.setVolume(0.3)
return task.cont
if 460<k<920:
mySound.setVolume(0.4)
return task.cont
if 0<k<460:
mySound.setVolume(0.5)
return task.cont
return task.cont
taskMgr.add(exampleTask, 'MyTaskName')
# Create the four lerp intervals needed for the panda to
# walk back and forth.
pandaPosInterval1 = self.pandaActor.posInterval(13,
Point3(-75, 15,-20),
startPos=Point3(-55, 2300,0))
pandaPosInterval2 = self.pandaActor.posInterval(13,
Point3(-55, 2300,25),
startPos=Point3(-60, 15,-20))
pandaHprInterval1 = self.pandaActor.hprInterval(3,
Point3(180, 0, 0),
startHpr=Point3(180, 0, 0))
pandaHprInterval2 = self.pandaActor.hprInterval(3,
Point3(0, 0, 0),
startHpr=Point3(180, 0, 0))
# Create and play the sequence that coordinates the intervals.
self.pandaPace = Sequence(
pandaPosInterval1,
pandaHprInterval2,
pandaPosInterval2,
name="pandaPace")
self.pandaPace.loop()
app = MyApp()
app.run()
if someone have another solution to make a movement between 2 screen it will be great
thanx you all…