Collision with one object for a sound to play only once?

Hi,

So if I want a sound to play once, once the player has contact with a object, how would I create this brick program.

Obviously the most basic first step is a collision And sound brick. So some type of instruction of once to be played, otherwise a object can be collided with a number of times repeating the sound, so it doesn’t create a particular effect or response at a certain time.

Thanks.

You’re looking for the Pulse button. It’ll trigger the collision sensor once, then it’ll automatically deactivate collision detection until either object has moved away from the other, in which case the collision detection will be reset and will activate again normally: if the object collides with it again.

image

You can also use the Tap setting, but it relies on true pulse being disabled, so it’s not always the right tool to use.

Hmm, I mean something more where the collision happens once within the game until, obviously ended or restarted.

So sound effects are good to use once for an effect.

An example of it in the 3D view.

Your current setup should already be what you’re looking for. Is there something else that you’re trying to achieve?

the Tap will just ask the sound actuator to be silent straight after

the pulse with this sensor is about sending another pulse even it staying in contact with the first object. And since there’s only 1 player he’s controling …

Since he wants to play a cutscene, i guess he wants to play it once and only once. So the collision has to be used to set a value to a property and no way to go back

actually, 1 control brick is enough

No cutscene, just a sound. Why have the sound play more than once, that just gets repetitive, unless it is music or a door opening.

I want one sound to play for effect. To create curiousity for the player.

Both of the suggested setups should only run once. If your sound is playing more then once then something else must be calling it, maybe some Python code of yours that you’re running elsewhere.

There can’t be any python code, since it is a brick program as seen.

playerobjectsoundcollision.blend (464.2 KB)

Here is a basic file, so the player is dynamic, and the object is static and ghost.

blenderaptor’s logic-brick setup should be what you want though… is there something you’re not understanding?

I didn’t use a capital letter for True and False.

One problem I do have is, once the default AI has been disabled, the AI stops the Player object from moving past it, what is the solution to that?

Physics; Actor and ghost, are active, and it is a static for the main objects on the AI body object, lower, middle and head area.

Static works to stop it going through some barriers, dynamic only makes the AI sink through the level.

Doesn’t this stop your player as well.

No, I will post a blender game exe, I could post the blend, but I wanted to see what I would end up with, so far 250mb for a zip. Ouch. The original FPS was 84mb or something. Currently it is 157mb.

239mb file