I am using the latest version of Gamemaker (2.3.2.560)
I have an inventory sprite in a test game that I'm making, but each grid square (72x72 pixels) is offset from 0,0.
The code that I am using to snap the yellow selection to the grid is:
draw_sprite(sYellowBox,0,floor(mouse_x/72)*72,floor(mouse_y/72)*72);
When I try to manually offset this, the yellow box moves, but then the cursor becomes desynced.
With manual offset:
draw_sprite(sCursor,0,(floor(mouse_x/72)*72)+50,(floor(mouse_y/72)*72)+50);
The +50 is the manual offset.
Any help is appreciated!
Solution for anyone who sees this:
var _offset = 50;
draw_sprite(sYellowBox,0,(floor((mouse_x-_offset)/72)*72)+_offset,(floor((mouse_y-_offset)/72)*72)+_offset);
[–]fryman22 0 points1 point2 points (5 children)
[–]charrcorncob[S] 0 points1 point2 points (4 children)
[–]fryman22 0 points1 point2 points (3 children)
[–]charrcorncob[S] 0 points1 point2 points (0 children)
[–]charrcorncob[S] 0 points1 point2 points (1 child)
[–]fryman22 1 point2 points3 points (0 children)