How do I click one time on an icon and turn off music and click one more time and turn on music?

0 favourites
  • 6 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • Hi there, I want to click left on a sprite to turn off music. The animation of the sprite will change. When I click left again the music should turn on again.

    It just does not work. I can do the first part (turn off/change animation) but the second click is always ignored by the system.

    If I click left and right it works.

    Does anyone know how I can do this?

    Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I can't see your events but most likely you have it set to toggle on and off with a variable condition. Since the events run top to bottom on one of the clicks it could be turning it on and off in the same click. You should use an 'Else' for the second condition.

  • Hi Lionz,

    Thank you for the quick answer. I tried it many different ways, also with variables. The "else" is red when I put it under the mouseclick. Everywhere else I can use it, only on the mouseclick not.

    Do you know why it gets red? Is there documentation on each of the commands and how they interact. The "help"-documentation from Construct3 itself was not very helpful.

  • The Else in red just means it doesn't make sense where it is or in that context. If you share a screenshot of your event how you attempted the icon change then it is easier to assist.

  • the mouse click is a rigger and can't have an else.

    the else under your event is red because it is not associated with any event.

    you can have a sub-event for the mouse click trigger that checks your global variable and turns music on or off.

  • Thanks a lot - it works now! :-)

    Had another condition in combination with "else". After getting rid of that one the behaviour is as expected.

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