First things first, Do not post screenshots or videos of your code.this all photos where is I used position_meeting to cursor
except for the first photo
cr_none
is a constant, check out this page in the manual for more cursor related constants. What that snippet is saying (with cr_none) is "if a collision has been found at the mouse_x and mouse_y position with... some constant value that never changes... then set the cursor sprite". The last argument in position_meeting() is obj: The object (or instance id, or the keywords "all" or "other") to check for a collision with. Cr_none is not an object, it is not a instance ID, and it is not a "special keyword" - it is some constant value set by GameMaker.position_meeting()
in the step event like that should absolutely work as intended and change the cursor sprite. My best guess is that some other piece of code somewhere is trying to set the cursor sprite too, most likely every step.is this rightFirst things first, Do not post screenshots or videos of your code.
Secondly as mentioned before,cr_none
is a constant, check out this page in the manual for more cursor related constants. What that snippet is saying (with cr_none) is "if a collision has been found at the mouse_x and mouse_y position with... some constant value that never changes... then set the cursor sprite". The last argument in position_meeting() is obj: The object (or instance id, or the keywords "all" or "other") to check for a collision with. Cr_none is not an object, it is not a instance ID, and it is not a "special keyword" - it is some constant value set by GameMaker.
Third, something else must be going on here - callingposition_meeting()
in the step event like that should absolutely work as intended and change the cursor sprite. My best guess is that some other piece of code somewhere is trying to set the cursor sprite too, most likely every step.
Go to Windows -> Search Results and search for everything in your code that says "cursor_sprite". Press Shift + Control + F if the search window does not pop up at first - then just use the "search" feature and press "find all". This will list everywhere in your code that "cursor_sprite" appears and show it to you in the Search Results window.
cursor_sprite = spr_cursor;
window_set_cursor(cr_none);
If that is in your project and it is running the Step event, then no wonder your other attempts to setis this right
GML:cursor_sprite = spr_cursor; window_set_cursor(cr_none);
cursor_sprite
also in the Step event are failing.cursor_sprite
, and also why Prrz is saying this:When multiple sources are all constantly trying to set a single variable, only the one coming last will succeed, the others will fail by being overwritten. Educated developers know this is a classic race condition. In your case, that coveted variable isMy best guess is that some other piece of code somewhere is trying to set the cursor sprite too, most likely every step.
cursor_sprite
, and the race is instance ordering. Any educated GM user knows how flimsy code can get when they become dependent on instance ordering.cursor_sprite = spr_cursor;
to Begin Step. That way the special cursor sets in the Step events elsewhere will always win over it when they apply. And when none of them apply (i.e. the mouse is not over anything special), the default winner will come out to be the normal cursor.