Play Sound

This forum is currently in read-only mode.
From the Asset Store
A set of board games to make your day joyful. Play, Enjoy, Relax
  • Okay, so im making a breakout game, but i encountered a problem during my time adding sounds effects. When my ball hits the bricks i want to play a break sound.

    So far i've done:

    Event: Start of layout - XAudio2: Load file AppPath & "Break.wav" to channel 1 (No loop)

    Event: On collision between Ball and Brick1 - XAudio2: Play Channel 1

    The problem is that the sound only plays when i hit the first brick, how do i make it play the sound every time i destroy a brick?

  • Is there anyone that can help me with this issue tonight, i need help as quick as possible.

  • You should use the autoplay file action. Alternatively, put your load file action into the event where the ball hits the brick.

  • Or you put after the "play channel 1" command, "channel set position to 0.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Re Playing sound

    + On collision between Ball and Brick

    + System: Trigger once

    -> XAudio2: Autoplay file AppPath & "sounds\Smash.ogg" (No loop)

  • What if I want to play it on a specific channel?

  • A sound channel does not reset its position automatically. You have to stop it playing and reset its position manually. So do what zyblade wrote with the change that you set the position to zero prior to playing the channel.

    + On collision between Ball and Brick

    -> XAudio2: Set Channel 1 Position to 0 seconds

    -> XAudio2: Play Channel 1

    Edit: I'm sorry, you also have to add this line to your event sheet:

    + XAudio2: [negated] Channel 1 is playing

    -> XAudio2: Stop channel 1

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)