How can i do switcher from 1 to 2 and back by 1 button?

0 favourites
  • 4 posts
From the Asset Store
Helping streamers give their viewers more excitement.
  • How can i do switcher from 1 to 2 and back by 1 button?

    i do something like

    -if button pressed and variable = 1 then make variable 2

    -if button pressed and variable = 2 then make variable 1

    but as i can see, these events work one after one, so i always have my variable = 1

    of course, i can do it by 2 buttons, but i wanna with one, is it possible? pls help me

  • The second event needs "Else" added.

  • yea, thanks, i found guide on the forum about else in this situation, but it works properly only in suck case. but i have under one event subevents about whole group of my sprites, where each has to be switched from 1 to 2 anb back. by using "else" i cant realise it, but i also found that i can do it following way:

    --if button pressed and variable = 1 then add 1 to variable

    -if variable >1 then make it 0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Variable=1 and the else should be subevents of on button pressed and it should work.

    You can also toggle the variable between 1 and 2 with one event:

    On button pressed

    --- set variable to 3-variable

    Just be sure the variable starts as 1 or two.

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