|
Post by commended on May 31, 2017 20:35:46 GMT
Hi all,
I'm in a bit of a rush and I was wondering what the easiest or if not any way to make randomised music, so whenever the game starts it will pick a random song.
Any ideas?
|
|
|
Post by Power Supersport on Jun 1, 2017 8:21:13 GMT
The easiest way would be to add all the music tracks as different soundeffect objects and then randomize the selection of one by a script...
int music = 0; int maxMusic = 3; // The total amount of music tracks int [] OBJ_TRACK (3); // Manually edit the amount here void Main () {
if (iInitializing ()) { OBJ_TRACK [0] = OBJ_0; OBJ_TRACK [1] = OBJ_22; OBJ_TRACK [2] = OBJ_44; // Add more for more tracks } music = iFloatRand (0, maxMusic); for (int i = 0; i < maxMusic; i++) { if (i != music) iObjectStop (OBJ_TRACK [i]); else iObjectStart (OBJ_TRACK [i]); }
}
|
|