How do I pause/resume audio

0 favourites
  • 14 posts
From the Asset Store
100+ Musical High Quality Sound Effects for your game!
  • Hi there,

    I was wondering how to pause audio. From what I can see nothing in the audio commands seems obvious to clearly pause/resume sound. delta time doesn't effect it or anything else I've tried.

    Thanks!

    Caleb

  • I do this via a global variable "Sound" (1 = Playing / 0 = Off) and a toggle button.

    [attachment=0:20rflh5m][/attachment:20rflh5m]

    Important is to use the "Trigger once" function. Otherwise your sound will be permamently started.

  • There is a pause/resume event under the Audio Plugin.

  • There is a pause/resume event under the Audio Plugin.

    But this doesn't work on mobile games, because buttons doesn't work on mobile games. You need to use sprites instead

  • > There is a pause/resume event under the Audio Plugin.

    >

    But this doesn't work on mobile games, because buttons doesn't work on mobile games. You need to use sprites instead

    Buttons works on mobile games (unless you meant using cocoonjs or ejecta)

    But I am not sure if the pause and resume works well on all mobile though, but is that really something we should care while learning c2 itself? Nope

  • doh.. how did i miss that? spongehammer thanks for pointing that out! Also thanks for offering an alternative. AndreasR thanks!

  • > There is a pause/resume event under the Audio Plugin.

    >

    But this doesn't work on mobile games, because buttons doesn't work on mobile games. You need to use sprites instead

    ...

    it is recommended for developers to replace standard buttons with sprites.

    creating buttons with Photoshop and add touch behavior.

  • I seem to recall the OP asked about pause and unpause of music.. nothing to do with buttons...

  • We just want to let him know that buttons doesn't works (if you compile with CocoonJS)

  • what do you mean by "buttons"? To me any "button" on the screen is a sprite or other game object (sprite text, for example). They always work for me. The audio commands should work.

    Or are you talking about android buttons like the back button? The physical ones? If so that's good to know, but yea kinda off topic

    I'm surprised though that C2 doesn't have a way (that i'm aware of) to use android buttons. There is no "android" game object to add into a game to access it.. like the one that thehen made for Windows Phone 8.0

  • what do you mean by "buttons"? To me any "button" on the screen is a sprite or other game object (sprite text, for example). They always work for me. The audio commands should work.

    Or are you talking about android buttons like the back button? The physical ones? If so that's good to know, but yea kinda off topic

    I'm surprised though that C2 doesn't have a way (that i'm aware of) to use android buttons. There is no "android" game object to add into a game to access it.. like the one that thehen made for Windows Phone 8.0

    Last statement for this off-topic button thing

    Yes you can directly insert buttons (not as sprite) in C2. But this "Buttons" will not appear if you compile your project with CocoonJS. Just double-click in the white editor area and look for "buttons".

  • part12studios

    I just PM'd You

    Thank you

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • hello i made a game in construct 2 for android when the user is idle and the game window is idle the background music is still playing cany ou pleas tell how to overcom this problem?

  • better of starting a new question for this.. if you mean the phone screen turns off.. that's a system level thing going on. i don't think you can do anything about that.. i may be wrong about that but basically imagine if your app were a music player.. you'd want the sound to keep playing, not turn off..

    one thing you could do is setup a timer that basically turns down the volume after so many idle seconds IN your game.. then you just make sure that "on any touch" you set the volume to full again.. of course it won't matter if it's already on the volume is maxed.. that's one quick / dirty hack that should work.

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