Working with Songs/Music
Kumii
Member, PRO Posts: 30
Hey guys,
I'm trying to create a music player containing 12 songs. So far I was able to create a player with all the necessary features a music player requires (play/pause, next, and previous).
However I noticed that when a track over track 7 is selected, it gets stuck on that track and I am no longer able to switch the tracks. Is there a limit of songs that can be inserted in Gamesalad or something? I know the size of mp3 files makes the app itself become a large file. Could this be the issue?
I'm trying to create a music player containing 12 songs. So far I was able to create a player with all the necessary features a music player requires (play/pause, next, and previous).
However I noticed that when a track over track 7 is selected, it gets stuck on that track and I am no longer able to switch the tracks. Is there a limit of songs that can be inserted in Gamesalad or something? I know the size of mp3 files makes the app itself become a large file. Could this be the issue?
Answers
Creat a game index named TrackIndex and set its value to 1
Create an actor that will function as your next button. Add it to your scene.
Create another actor that will play the sound.
Now open up that next button actor and put in a rule:
When actor is pressed (and)
game.TrackIndex is not equal to 11
Change attribute game.TrackIndex to game.TrackIndex+1
Otherwise
Change attribute game.TrackIndex to 1
Add the play sound/music behavior to the 2nd actor, but where you put the track name you now enter the formula for selecting a table cell value. From the centre pull down menu in the expression editor, select the tableValue (or whatnot it's called) option. Set table to TrackList, the row to game.TrackIndex and the column to 2. For it to work you have to nest it in a timer set to zero seconds, with run to completion off.
On tapping the next button your tune will change.
Do the same for you previous button, and you can now also easily create a random button too.
Hope this helps.