• 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 Clicking on a sprite

P

prithvidiamond

Guest
Hello guys I am back with another useless and noob problem in GML (cause I am noob :( ):

You see I want to click on a sprite such that if it equal to a variable, it does something.

I am unable to code this and would like some help (more like tutoring cause I am NOOB :( )

All help is surely appreciated from such a wonderful community,

prithvidiamond
 

johnwo

Member
Use something like:
Code:
// Step event
if mouse_check_button_pressed(mb_left) { // Check if a mouse button was pressed; mb_left = left mouse-button
    var inst = collision_point(mouse_x, mouse_y, YourObject, true, true); // Check the mouse_x/y position for an instance, store that instance-id in the variable inst
    if inst != noone and YourCondition then { // Add your condition here
        // Do something; Add your statements here.
    }
}
Hope that helps!

Cheers!
 
P

prithvidiamond

Guest
Use something like:
Code:
// Step event
if mouse_check_button_pressed(mb_left) { // Check if a mouse button was pressed; mb_left = left mouse-button
    var inst = collision_point(mouse_x, mouse_y, YourObject, true, true); // Check the mouse_x/y position for an instance, store that instance-id in the variable inst
    if inst != noone and YourCondition then { // Add your condition here
        // Do something; Add your statements here.
    }
}
Hope that helps!

Cheers!
I will surely try,

Thanks,

prithvidiamond
 
Top