• 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 Check if object is clicked

V

VansiusProductions

Guest
Hi
I want to test if an objects is clicked. When the object is clicked for the first time, it sets a value to variable A, if it's clicked for the second time, it sets a value to variable B. When it's clicked and both A and B have a value, it does nothing. How do I achieve this?
 

Llama_Code

Member
Initialize variable A and Variable B to 0.

When you click check the value of A, if it's 0 set it, if it's not 0 then Check the value of B, if it's 0 set it.
 
V

VansiusProductions

Guest
Initialize variable A and Variable B to 0.

When you click check the value of A, if it's 0 set it, if it's not 0 then Check the value of B, if it's 0 set it.
Thanks for the reply, i used if else for that but only A is working and B isn't. This is my code:
Code:
if (global.mouseTouch = 1 && global.groupHover != "none") {
  if (global.groupHover = 0 && global.groupSelectedA = "none") {
    global.groupSelectedA = global.groupHover
    instance_create(352,62,obj_group_air)
    global.mouseTouch = 0
  }
  else {
    if (global.groupHover = 0 && global.groupSelectedA != "none" && global.groupSelectedB = "none") {
      global.groupSelectedB = global.groupHover
      instance_create(352,222,obj_group_air)
      global.mouseTouch = 0
      exit;
    }
  }
}
How do i check if the player clicked on the object, The only event i have is mouse left pressed which is pretty vague.
 
Top