Sounds in blender game engine

Okay, I have a wav file. It is suppose to be an attacking sound effect for an enemy in my game. I’m trying to play it when the enemy’s attacking animation reaches a certain frame. I have the logic bricks set like this:

Property: attackframe = 12 - AND - Sound:Play Stop | Volume: 1 | Pitch 0

But it doesn’t play the sound, though I hear like tiny pops on my speakers. The sound only plays with the always sensor. I also tried connecting an always sensor, but it it still won’t play at the frame and will only play once. How do I get it to play at a certain frame?

hi philman,

Use Play End instead of Play Stop



Sound_Frame.blend (211 KB)

thanks alot! I wish play stop would work though. I would have liked to be able to play it all the way, but be able to interrupt it also. but oh well.

hi philman,

Property Sensor: Have you tried using Interval instead of Equal? That will let you use Play Stop to play your sound. Maybe that would work.


Interval should work. The reason it is stopping is that the sensor is no longer true - i.e. attackframe is no longer equal 12. There are other options, depending on your details - for example, on the start case you could also set a property and OR that property into the controller, so that once started, it keeps going (until whatever other controller it is you have stopping it activates). Generally I try to avoid complicated logic bricks like that though - at some point it’s cleaner to write 2-3 lines of Python instead.