Button for turning background on/off

LiekeLieke Member Posts: 7

Hi guys.

I want to make a button that turns my bg and all related elements on and off. My app is for autistic children, therefore I want to provide them the option to filter cues.
What I've done so far is working for turning bg off, but it's not working for turning it on again:

  • I've created a boolean, named "bg" and ticked the checkmark on
  • I've created the following rules in the prototype of the button-actor:
  • when touch is pressed
    and attribute game.bg is true
    change attribute to 0

  • when touch is pressed
    and attribute game.bg is false
    change attribute to 1

However the second rule is exactly the opposite of the first rule, the background turns off, but when you click again it doesn't turn on again.

Can anyone help me please? Thanks in advance!

Comments

  • LiekeLieke Member Posts: 7

    Anyone, please?
    It's a pity I can't upload screenshots.

  • SocksSocks London, UK.Member Posts: 12,822
    edited May 2014

    @Lieke said:
    Anyone, please?

    When touch is pressed - Change alpha channel to 1-alpha channel.

    That will toggle the actual image on and off . . .

    . . . . . . .

    . . . but if you want a button to control another actor - then make a game level integer attribute, let's call it X.

    In the button:

    When touch is pressed - Change X to 1-X

    In the BG image:

    Constrain alpha channel to X

    . . . . . . .

    Using an interpolate to change the alpha value looks a little more slick.

    Example: https://www.mediafire.com/?6rk9nc16phhkcj1

  • LiekeLieke Member Posts: 7

    Thanks a lot Socks! It works

Sign In or Register to comment.