Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Snaps the X/Y values accordingly to a specified isometric grid
- //Automatically rounds X/Y values
- //arg0 - X value to be snapped to
- //arg1 - Y value to be snapped to
- //arg2 - X snapping factor
- //arg3 - Y snapping factor
- //returns nothing
- //Example
- //sc_grid_snap(x,y,32,16);
- //That code snaps the object to a 32x16 isometric grid
- //The room grid can be used to "pre-test" a grid when set to "Isometric"
- var yy, check;
- yy = argument1;
- x = sc_round(argument0,argument2/2);
- y = sc_round(argument1,argument3);
- check = sc_round(x,argument2);
- if (check != x)
- {
- if point_direction(x,y,x,yy) = 90
- {
- y -= argument3/2;
- }
- else
- {
- y += argument3/2;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment