How do I make random music playing?

Get help using Construct 2

Post » Mon Jul 28, 2014 3:31 pm

Example when opening layout 1 : start play music 1. then,restart layout,play music 2/3/4/5/1. anyone can help me?
~Everyone can make GAMEs~
B
60
S
12
G
1
Posts: 416
Reputation: 6,022

Post » Mon Jul 28, 2014 3:36 pm

https://www.scirra.com/manual/126/system-expressions

choose(a, b [, c...])

IE: choose(1,2,3,4,5)
ImageImageImage
B
71
S
22
G
273
Posts: 3,822
Reputation: 150,787

Post » Mon Jul 28, 2014 3:40 pm

I don't know if the issue is so simple, but I can advise you to use global variable and set music to this variable, but for variable you should use choose (1,2,3,4).

SO: On start of layout set global variable value to "true"

if true
on start of layout set value music choose 1,2,3
set music to global variable music
B
7
S
1
Posts: 73
Reputation: 603

Post » Mon Jul 28, 2014 4:22 pm

i'm bit little confused,anyone can make the example please?
~Everyone can make GAMEs~
B
60
S
12
G
1
Posts: 416
Reputation: 6,022

Post » Mon Jul 28, 2014 4:48 pm

@Hardty

Here's a simple example for you:

Random Music Example.capx


It will randomly play a music track when the layout starts (or the music ends). It will also do a check so that it doesn't repeat a track.

No music is included, but it should work if you add music with names Track1, Track2, ..., Track5.
You do not have the required permissions to view the files attached to this post.
Find all the Construct 2 games that were on Steam Greenlight here
B
38
S
10
G
7
Posts: 501
Reputation: 7,129

Post » Tue Jul 29, 2014 5:46 pm

Nicee!! Thanks @OddConfection :D
~Everyone can make GAMEs~
B
60
S
12
G
1
Posts: 416
Reputation: 6,022


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 14 guests