Like if it rotates 45 degrees, and I create a random object in the grid, it would snap to the nearest 16x16 spot, relative to 45 degrees. Does this make sense?
I tried to divide by 16, round, then multiply, but that makes it rotate in a snap-grid fashion. I wanted it to orbit smoothly, while still be 16 distance away from another object rotating around the same thing. I hope its not too complicated...
I hope to hear from the community soon. Thanks for reading and extra thanks for whoever can solve my problem.
Ok, I've tried this way, but it doesn't work.
parent = obj_planet; par_dist = distance_to_point(parent.x,parent.y)+(32); rev_pos = point_direction(x,y,parent.x,parent.y)+180; x = floor((parent.x+cos(rev_pos*pi/180)*(par_dist))/16)*16; y = floor((parent.y-sin(rev_pos*pi/180)*(par_dist))/16)*16; par_dist = distance_to_point(parent.x,parent.y)+(32); rev_pos = point_direction(x,y,parent.x,parent.y)+180;
I believed it would work since it snaps to a 16 when it is created, but when I tested it, it seems to ignore what I state here, even though I used show_message to tell me that the coords did change when I tried to snap it to grid.....Just putting it out there for further info.
Hope you guys can help me.
Edited by andykuo1, 08 April 2012 - 06:27 AM.