Sprites - Visibility - Clickability

  • I have a bit of an issue with my code, I've done a simple mute/unmute music sprite.

    Originally I made it a single sprite with multiple frames but even if I had animation set to STOP it would still animate strangely.

    The other issues is once I separated them and placed them on top of each other that I could only click one button. I changed that and slightly overlapped them to see what is happening, it seems that despite being on the same layer, in the order being placed under and being set to invisible, the sound off was not clickable when sound on was placed over it.

    Here is an example in pictures;

    Inside the development environment

    Selectable sound on area

    Selectable sound off area

  • Sprites Z order, layer order or visibility does not interfere if it's clickable or not.

    Instead of using a button over the other, try creating a single sprite to work as your button and then change it's frames depending on how it's toggled.

    Sorry if I can't help any further, but I don't quite understood your problem D:

  • I guess you aren't using an else statement?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sprites Z order, layer order or visibility does not interfere if it's clickable or not.

    Instead of using a button over the other, try creating a single sprite to work as your button and then change it's frames depending on how it's toggled.

    Sorry if I can't help any further, but I don't quite understood your problem D:

    I was basically using two sprites on top of each other and making one visible and the other invisible on each click but the sprite on top was never clickable even if the sprite under it was set to invisible.

  • Easiest way would be with one sprite with 2 frames:

    On sprite clicked

    -- sprite frame = 0

    set frame to 1

    set sound on

    -- else

    set frame to 0

    set sound off

  • On sprite clicked -> set sound to 1-sound
                      -> set frame to sound
    [/code:1e4gy7ne]
    This will suffice to switch sound  on/off  and same time set proper animation frame to represent sound state.
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)