Sound not playing first time (possible bug?)

0 favourites
  • 9 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • I'm creating a Breakout clone and it's going well.. except for one little annoying thing! When the ball hits a brick (which in this case is an alien) then BEEP_16 should play (and the alien is destroyed), and it does... for all but the first alien hit. The first alien hit, no matter which one, there is no sound, but the sound plays for all the other aliens when hit (the alien is destroyed though).

    Below is the Event sheet, I'm preloading the sound and playing it 'on collision with Alien01'

    [attachment=0:3ceux9y0][/attachment:3ceux9y0]

    Can anyone point out why it won't play when the first alien is hit?

    Thanks.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Look into pre-loading sounds. Read about it in the manual in the audio section. It covers it pretty well. The sound gets loaded the first time it is called which means there will be a lag in the first play.

  • I'm already preloading the sound, it's there in the event sheet, if that's what you mean.

    Preload loads a file without playing so that there is no lag when playing it for the first time.

    from the manual:

    [quote:hdq5uj40]You can also use the Preload action to start downloading an audio file without actually playing it. This can be done on Start of layout to start downloading a few important sound effects so there is no delay when they are played for the first time.

    So wouldn't the sound be ready to play as it's been preloaded?

  • Well you got me stumped then

  • Weird thing is that I can play the sound at the start of the layout so it's definitely there, it just doesn't play when the first alien is hit.

  • Right, I've narrowed it down to:

    Play BEEP_16 not looping at volume 0db at object Alien01 (inner angle 360, outer angle...).....

    This is a positional play and should play the sound at the position where the alien was hit, a left-hand side alien will play the sound over to the left when hit and a right-hand one will play it over to the right.

    Putting a normal Play instead of Play at object works and will play when the first alien is hit. Is this a bug with Play at object or is it designed this way?

    Anybody?

  • It depends, some sound features require the advanced audio API which is not supported on all browsers, directional audio I believe is one of those...

  • I'm using the latest stable FireFox (27.0.1) and directional audio is working, just not for the first alien where there's no sound whatsoever.

  • I'm using the latest stable FireFox (27.0.1) and directional audio is working, just not for the first alien where there's no sound whatsoever.

    Sorry to bump a post this old, but it seems there's still some problems with this. In my project the first time directional audio is played it always results in about 1 second freeze. Is there anything that can be done to prevent this?

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