• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM efficient way of doing this?

Y

yasin

Guest
I have here a working code that I always use but my question is can this be done more efficient/easier?

Code:
if (mouse_check_button_released(mb_left)){
      if variable == 0{
                   variable = 1
            }
      else
            {
                  variable = 0
            }
};
 

obscene

Member
if (mouse_check_button_released(mb_left)) variable=1-variable

Also make sure you are only checking the mouse input ONE time in your entire step events. I've seen lots of people may check an input multiple times in different codes. Check inputs one, set variables and then check those variables.
 

Tizzio

Member
if (mouse_check_button_released(mb_left)) variable=1-variable

Also make sure you are only checking the mouse input ONE time in your entire step events. I've seen lots of people may check an input multiple times in different codes. Check inputs one, set variables and then check those variables.
another way:
Code:
variable = !variable;
 
Top