On / Off Button Problem :s

0 favourites
  • 15 posts
From the Asset Store
J-BoB Game Button Sound Pack comes with 300 high-quality sound effects
  • I'm trying to make a button that sets the Grid either Visible or Invisible..

    It did not work with a Global Variable, and now it is not working with "Visible"

    --------------------------------------------------------------

    *Event:   Mouse Left Clicked on "Grey_Button"

          

           *Sub-Event:   "Red_Light" = Visible

                     (Action): Set "Grid" Visible

                     (Action): Set "Red_Light" Invisible

                     (Action): Set "Green_Light" Visible

       

           *Sub-Event2: "Green_Light" = Visible

                     (Action): Set "Grid" Invisible

                     (Action): Set "Green_Light" Invisible

                     (Action): Set "Red_Light" Visible

    --------------------------------------------------------------

    Not working... What am I doing wrong?

  • Can you try using "on mouse button released" instead of left click? And add another condition "cursor is over grey button". If that works I think I know why this happens.

  • nope not working

    dl.dropbox.com/u/53738503/RebirthTD%20(2).capx

    feel free to try it out

  • Can you remove the plugins?

  • you mean deleting them in my folders?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • On the project .capx, if other people don't have them installed we can't open it.

  • dl.dropbox.com/u/53738503/RebirthTD.capx

    I have removed button and keyboard.

    Are you using the newest Beta?

  • ive implemented my way of doing switches

    not sure what the colors do..

    grid

  • Simple toggle

  • ohh i forgot to remove that, soz

  • Thx you two :)

    Could you perhaps explain a bit? So that it gets stuck in my head

    vtrix        grid = 0?1 :0

    newt          Sprite.var%2=0 ?100 :50

    I mean.. I get it.. but I did not know the syntax

  • Guide to Construct 2's event features

    See the section on 'Else', and why it fixes events like you've set up.

  • % or modulo returns the remainder from division so variable%2 would be the remainder of the variable divided by 2. Then as you know, any even number divided by 2 has a remainder of 0, since they are all divisible by 2. That also means any odd number will not be 0.

    ? : are conditionals. If you do a comparison, like 1=1, the system will take the question mark to mean that anything after ? is to be taken when the condition is true. Then anything after : is to be used if it was false. so 12%2=0 would give you 0 as a remainder, and be true.

  • Ashley Very Insightful Ty :)

    newt Ah! :D Ty, I'm glad that we are able to use math in C2 if we choose too

  • Hello got a trouble about 2 states sprite button (switch).

    If I move button_1 to bot layer to make the button_2 at top the mouseclick is still affected at the button_1

    if I make button_1 invisible and make button_2 visible the mouseclick does'nt work too in all ways the button_2 is not affected by any click because the button_1 is logicaly always present.

    Tried destroy or move outside the layout but fail.

    Any idea about this?

    'mega.co.nz/#!4h9yjKKR!CddgGZVB0-eyT7mI0jOYSIIuKATLB7fLpW7dy0MRrAM'

    (switch_fail.capx)

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