Sound and music problem!!!!

applecrayzyapplecrayzy Member, PRO Posts: 6
edited August 2012 in Working with GS (Mac)
Hi guyz, i am busy creating an app for kids. On screen will be a few actors. If an actor is touched, play sound or music works fine. My problem is, i need instructions from you guyz on how to play the next actors sound(by touching actor), and stop the previous actor's sound/music.
I followed Tshirtbooth youtube example on WORKING WITH SOUND, but it doesnt answer my problem.

To give you a clearer example. If for instance you have 15 actors on screen which is actually an Music CD. To play track 1 is eazy, cos i just touch Track 1 actor and it plays. If i'm fed up of Track 1 and wanna listen to Track 5 for example, i just wanna touch Track 5 actor, and it must play and automatically stop Track 1.

Please help, with instructions. If you can make a video clip and publish to youtube, that will much appreciated.

Comments

  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    edited August 2012
    There is a complicated way to do this with custom attributes, but it takes a lot of them, and I believe this can be done now with tables, which would be much more efficient. But I'm not good with tables yet, so I'm of no help to you. Sorry.
  • jonmulcahyjonmulcahy Member, Sous Chef Posts: 10,408
    did you import the files as sound or music?
    as far as i know, music files can only be played one at a time, sound files can overlap
  • applecrayzyapplecrayzy Member, PRO Posts: 6
    JonMulcahy Thanx for your suggestion---it works beautifully as a music file :D =D>.
    UptiMistik, big round of applause =D> to you. :x I'm so happy now, i dont wanna go sleep and its 05h36 in my part of the world. Hope this app brings joy to alotta kidz, thanx to you guyz.
  • auntieginzyauntieginzy Member Posts: 50
    very easily done my friend. I've included a test project. Download, import your songs in it (as Music, not Sound) and try them out.
    On each of the actors, put in a sample music track (I would have done it, but it would make the file too big), simply open the actor, look in the rules and wherever you see 'Play Music', choose your own music file.
    All i've done is created one Game Attribute called 'Current Song'.
    You can then copy the rest of rules from the actors into your own project.
    Hope it helps!
    What format do you use for music on a Mac?
  • ericzingelerericzingeler Member Posts: 334
    edited June 2013
    You can simplify this process by creating:

    1. A game index attribute named "musicTrack".

    2. A single "music player" prototype actor with the following rule/s:

    If musicTrack = 1, play "selected music file 1"

    if musicTrack = 2, play "selected music file 2"

    and so on...

    3. So now, just throw this in the change track actors:

    (In track 1 actor) If touch pressed, change musicTrack to 1

    (In track 2 actor) If touch pressed, change musicTrack to 2

    (In next track actor) If touch pressed, change musicTrack to musicTrack + 1

    This is using the idea of separating global behaviors out of individual actors. This makes things easy to edit, offers better performance and reduces bugs.
Sign In or Register to comment.