Working with Songs/Music

KumiiKumii 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?

Answers

  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    There is no limit to the sound/music files you can add to GameSalad. It's possibly something within the logic. Can you post a screenshot of your rules?
  • KumiiKumii Member, PRO Posts: 30
    Would it be easier if I sent you the file somehow?
  • hiddevandijkhiddevandijk Member Posts: 17
    I would advise you to use a table for switching songs. Try this: make a table named: TrackList. 12 rows, 2 columns. Set the first column to index, and enter an increasing value of 1 to 12 in each of this column rows. Set the second column to text, and enter the 12 track names top to bottom in the order you'd like to play them. These names are the names of your sound files in GameSalad.

    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.
Sign In or Register to comment.