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
19
S
7
G
3
Posts: 183
Reputation: 2,884

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
94
S
18
G
9
Posts: 2,457
Reputation: 15,177

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
19
S
7
G
3
Posts: 183
Reputation: 2,884

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
94
S
18
G
9
Posts: 2,457
Reputation: 15,177

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
103
S
35
G
16
Posts: 1,227
Reputation: 17,198


Return to How do I....?

Who is online

Users browsing this forum: DH The Animtor, oosyrag and 6 guests