Change Music Automatically

Get help using Construct 2

Post » Fri Feb 21, 2014 8:26 pm

How do I make music change during the gameplay automatically. For example When 1 song is finished playing another song loads up and plays. And so on and on.
B
3
Posts: 3
Reputation: 181

Post » Fri Feb 21, 2014 8:46 pm

Yeah I want to know this too... How to do playlist whit random play? Maybe whit function...
B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Post » Fri Feb 21, 2014 9:16 pm

You can't do anything automatic when it comes to programming. You need to code it one way or another.

As for the random play list.

Create an array with all the song names. You can also use a CSV and tokenate randomly; instead of random.

Then create an Event for Audio on End with your "music" tag name.
Play music file = array(int( random(0, array.width) ) w/tag "music"
or
Play music file = trim( tokenate( csv, int( random(0, tokencount(csv,",") ), "," )
w/tag "music"

with that during your game when one song ends the other will begin.

boom easy, and not automatic.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Fri Feb 21, 2014 10:13 pm

jayderyu wrote:You can't do anything automatic when it comes to programming. You need to code it one way or another.

As for the random play list.

Create an array with all the song names. You can also use a CSV and tokenate randomly; instead of random.

Then create an Event for Audio on End with your "music" tag name.
Play music file = array(int( random(0, array.width) ) w/tag "music"
or
Play music file = trim( tokenate( csv, int( random(0, tokencount(csv,",") ), "," )
w/tag "music"

with that during your game when one song ends the other will begin.

boom easy, and not automatic.


@jayderyu. Many thanks for your help :D I will try with my project :D
B
17
S
5
G
2
Posts: 173
Reputation: 2,085

Post » Sat Feb 22, 2014 12:53 am

jayderyu wrote:You can't do anything automatic when it comes to programming. You need to code it one way or another.

As for the random play list.

Create an array with all the song names. You can also use a CSV and tokenate randomly; instead of random.

Then create an Event for Audio on End with your "music" tag name.
Play music file = array(int( random(0, array.width) ) w/tag "music"
or
Play music file = trim( tokenate( csv, int( random(0, tokencount(csv,",") ), "," )
w/tag "music"

with that during your game when one song ends the other will begin.

boom easy, and not automatic.


I still dont get it can you please post some screenshots? Im not that good with construct 2?
B
3
Posts: 3
Reputation: 181

Post » Sat Feb 22, 2014 3:11 am

Since your new. This link is the best link. Once that is grokked you will get tons of stuff :)

https://www.scirra.com/tutorials/37/beg ... onstruct-2
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,028

Post » Fri Mar 14, 2014 1:46 am

jayderyu wrote:....grokked...


I had to look up what this word meant... never have I heard it used... it's from Stranger In a Strange Land... cool reference..
B
98
S
32
G
16
Posts: 1,204
Reputation: 16,715


Return to How do I....?

Who is online

Users browsing this forum: Armench, dop2000, Jackriduk, kiki4construct and 24 guests