Game Sound ON/OFF Button Issue

  • This could be considered generic too, It's about interchanging position of two objects when clicked.

    <img src="http://dl.dropbox.com/u/48735785/Construct2_Issues/snd_on_off.png" border="0" />

    So as per the image,

    When Game starts...

    on_layout2 - is a sound ON button placed on visible screen area (136,370).

    off_layout2 - is a sound OFF button placed outside visible screen (-127,370)

    What I wanted to do...

    1. When User clicks on on_layout2, the object should move to position of off_layout2(-127, 370) and off_layout2 should move to visible screen (136, 370)

    2. When User click on off_layout2 that is now on visible screen, it should move to position of on_layout2 (-127,370) and on_layout2 should move to visible screen (136, 370)

    Action 1 works, but when I add the 2 action it doesnt work.

    The object on_layout2 just stays there.

    I have also tried putting in positions instead of using "move to position of another object"

    Same result.

    Been cracking my head over this past hour.

    Any suggestions. Help?

    Thank you,

    Krish

  • Thanks

  • Kyatric

    Thanks for share but when I refresh my browse or enter in second level it again go to in on mode or Animation Frame to 0..

    How to resolved this issue I thing if we store our value in array than we solved this issues do you have any sample which store there value in array

  • rob: why bother with arrays when all you need is a global variable ?

    MySpriteButton_Layouts

  • Kyatric,

    Thanks for the quick response,

    But again got same issues..

    which sample file you send me I have checked that when I was in level 1 I set animation frame-0, and click ok after click ok button it go to in level 2 but again it show me animation famre-1, which is default but My question is that when I have set it in animation frame 0 then when i go to in level 2 it should in same on there(animation frame 0 not animation frame 1).............

  • rob: indeed I had forgotten an action.

    Download the sample again, it's working as intended now.

  • Nice example Kyatric, I also usually use the local WebStorage to remember these user choices

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • gillenew: it's indeed the next logical step.

    You get the value from the webstorage in the very first layout of your project and each time the user changes it, you set the value to the global variable (for the current game) and save it in the webstorage too.

  • Kyatric,

    Thanks Kyatric it working fine My first issue has fixed but when I refresh my browser it again go to in animation frame 1 if I set in animation frame 0. so how can set it..

  • I've already explained in the post just before you ask the question rob, what about reading the informations already posted on the forums ?

    Otherwise I talk about it too in the Asteroid clone in less than 100 events tutorial.

  • Hey i followed your .capx file exactly, and i can't seem to produce the same output. When i click my button, it disappears. WHY?! :(

  • can someone upload the example with webstorage? I cant figure it out...

  • rob look at this example now do sound animation frame = 0 audio set not silent sound animation frame = 1 audio set silent or vise versa if you setup the animation frame differently

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