Hello,
This is OK, but I didn't really want to run all these algorithms as basically you only need one more in order to have a full 2d (3d deals with height, this is just front, sides and back).
Does openAl have any return saying if the object is behind the player?...
Thanks,

Brandon Keith Biggs <http://www.brandonkeithbiggs.com/>
On 6/6/2015 7:31 AM, [email protected] wrote:
Huh, thought I deleted that post.. :/

    What should happen is the sound should cut into the other one
    before the first one stops, so you get an overlap. This happens
    when you call play on the sound itself, but not when you queue a
    sound onto a player and play it over and over.


At the moment there's no way to do that without using multiple players, but you could handle this with an internal timer during updates and by keeping the Player references Source returns when you play them:

|
timer =0
running =False
sound = pyglet.resource.media('walking.wav')
|walking =[]
|defupdate(time):
    timer +=time
ifrunning ==Falseandtimer >=1.0:
walking.append(sound.play())
        timer = 0
    elif running == True and timer >= 0.3:
        walking.append(sound.play())
        timer = 0
#discard finished sounds
    for a in walking:
        if a.playing == False:
            a.delete()
            walking.remove(a)
|

    Sounds to be connected to objects like zombies. Those zombies then
    move around the map. This changes the sound's location both when
    the zombie moves and when the player moves.


It wouldn't be to hard to store playing sounds with a zombie class, but changing the sounds location around the map is abit more complicated. Is this a 2D or 3D game? I must confess, I haven't played with these particular features in pyglet yet, but I think you could use the Position variable on a Player sound object to set its position in 3D space, and then set up a Listener for the players position to "hear" it. You can change the Listeners orientation with _set_forward_orientation, and adjust the direction of the playing sound with player.cone_orientation. All of these take 3 tuple xyz floats for coordinates.

I've poked around abit in the pyget.media source, for the moment you can try calling pyglet.media._LegacyListener(), since it seems like the newer Listener object may not be fully implemented yet. So for example:

|
sound = pyglet.resource.media('walking.wav')
walking = sound.play()
walking.position = (-5.0, 0.0, 0.0) #xyz, off to the left of listener

listener = pyglet.media._LegacyListener()
listener.position = (0.0, 0.0, 0.0)
|

    When the zombie is behind the player, I would like it to lower in
    pitch.


You could try doing this by calculating the relative position and orientation between the zombie and player, then adjusting any stored playing sounds pitch, IE: player.pitch = (1.0).
--
You received this message because you are subscribed to the Google Groups "pyglet-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To post to this group, send email to [email protected] <mailto:[email protected]>.
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to