How do I make duplicate buttons independent?

0 favourites
  • 5 posts
From the Asset Store
J-BoB Game Button Sound Pack comes with 300 high-quality sound effects
  • I've two buttons, one duplicated from the other.

    On the first button, I want to play a sound file that says "yes" and the other button to play a sound that says "no".

    I thought it would be simple but am having difficulty trying to do this (newbie I suppose.)

    Is it possible to assign different sound files to duplicate buttons, ie a soundboard?

    Thanks!

    Bob

  • What I like to do is create an instance variable called ID. And then assign each instance a different value: 1,2,3...

    That way when you do the events you can do:

    + On button clicked

    If button instance variable ID = 1 - play sound1

    If button instance variable ID = 2 - play sound2

    etc.

  • Ok cool! I was able to use the variable instance to specify which sound to play.

    I have two mouse onclick entries each checking the id to play that specific audio.

    According to your scenario, you have one entry for mouse click. I assumed this would be the optimal way.

    Do you have a sample of how this could be done?

    Thanks again!

    Bob

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You use subevents basically, like this:

    <img src="https://dl.dropbox.com/u/1910765/example.jpg" border="0" />

    Is that clearer?

  • Ah yes, thank you! This makes perfect sense now.

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