How do I change the sounds (in order) with each click on the same object?

0 favourites
  • 5 posts
From the Asset Store
High quality sound effect pack, in the following categories: Simple, negative, pozitive
  • Hi, I have been looking for a long time but I have not found an answer. I have an object that should function like the button that runs a playlist, so I would like the sound to change with each click on this object as if it went on with the next song in chronological order. I just can't do it! Help! Thanks....

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Add all your sounds to the project with names like Sound1, Sound2, Sound3, .... Sound10

    Create a global variable SoundNumber.

    On Sprite Clicked 
    	If SoundNumber=10 : Set SoundNumber to 1
    	Else 	: Add 1 to SoundNumber
    	: Audio stop tag "mysound"
    	: Audio play "Sound"&SoundNumber with tag "mysound" 
  • Sorry, I'm a neophyte and I don't understand things written so. I would need all the steps or a screenshot directly on construct. 1) Load the sounds ok, I understand, 2) go on click mouse ok I understand

    then I don't understand ..

    3) where "if" is written because if it is a command that is not there but I seem to understand that I have to go to the system: compare variable equal to ten: then set sound number to 1's correct?

    4) else did not understand what it means? I don't find command else, where can I find it?

    5): Audio stop tag "mysound", : Audio play "Sound" & SoundNumber with tag "mysound". I really don't understand these, where should I go first? what comes before :Audio ? System? Audio? Moreover how do I tie sound1 sound2 sound3 to Soundnumber or to the tag sound?

  • 3) Yes, "if" is actually "Compare variable" condition.

    4) Select "Compare variable" event with mouse and press X, an "Else" condition will be added under it.

    5) "Stop" is an action of Audio object. You might want to stop previous sound before playing the next one, to prevent sounds overlapping.

    Every sound you play has a tag. If you want, you can assign different tags to each sound. But I guess in your case it's easier to use the same tag.

  • thank you so much for your availability and patience :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)