0 Favourites

How do I pause/resume audio

  • 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".

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • part12studios

    I just PM'd You

    Thank you

  • 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)
Similar Topics Posts Views Last Post
Unread hot topic
99 10,136
karshinkoff's avatar
karshinkoff
Unread hot topic
81 11,414
NathanClearyMusi's avatar
NathanClearyMusi
Unread hot topic
56 4,729
MPPlantOfficial's avatar
MPPlantOfficial