How do I pause/resume audio

Get help using Construct 2

Post » Wed May 28, 2014 1:38 pm

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
B
59
S
9
G
1
Posts: 946
Reputation: 6,561

Post » Wed May 28, 2014 1:51 pm

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

toggle_sound.png


Important is to use the "Trigger once" function. Otherwise your sound will be permamently started.
You do not have the required permissions to view the files attached to this post.
Image Image iTunes: Match3 | Google Play: Match3
B
103
S
37
G
31
Posts: 1,164
Reputation: 28,928

Post » Wed May 28, 2014 1:55 pm

There is a pause/resume event under the Audio Plugin.
You do not have the required permissions to view the files attached to this post.
B
50
S
16
G
9
Posts: 1,098
Reputation: 11,237

Post » Wed May 28, 2014 2:09 pm

spongehammer wrote: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 ;)
Image Image iTunes: Match3 | Google Play: Match3
B
103
S
37
G
31
Posts: 1,164
Reputation: 28,928

Post » Wed May 28, 2014 2:13 pm

AndreasR wrote:
spongehammer wrote: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
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Wed May 28, 2014 2:26 pm

doh.. how did i miss that? @spongehammer thanks for pointing that out! Also thanks for offering an alternative. @AndreasR thanks!
B
59
S
9
G
1
Posts: 946
Reputation: 6,561

Post » Wed May 28, 2014 6:10 pm

AndreasR wrote:
spongehammer wrote: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.
:mrgreen:
2D Game GUI Designer
B
12
S
4
G
3
Posts: 130
Reputation: 3,778

Post » Wed May 28, 2014 9:24 pm

I seem to recall the OP asked about pause and unpause of music.. nothing to do with buttons...
B
50
S
16
G
9
Posts: 1,098
Reputation: 11,237

Post » Thu May 29, 2014 5:18 pm

We just want to let him know that buttons doesn't works (if you compile with CocoonJS) ;)
Image Image iTunes: Match3 | Google Play: Match3
B
103
S
37
G
31
Posts: 1,164
Reputation: 28,928

Post » Thu May 29, 2014 9:11 pm

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
B
59
S
9
G
1
Posts: 946
Reputation: 6,561

Next

Return to How do I....?

Who is online

Users browsing this forum: worm1, Yahoo [Bot] and 21 guests