Building a Board Game

Bob Sneidar bobsneidar at iotecdigital.com
Tue Apr 7 15:36:38 EDT 2020


Just brainstorming, you would have to intercept mouseMove and then have a tolerance of points to your grid. Say three points. Assuming your grid starts at the top left of the window, you would div the top of the object with the vertical grid width, check for tolerance above and below, then set the object’s top to the nearest gridline. You will also need to set the mouseLoc by the same amount, or else capture the mouseLoc on mouseDown, record the distance from the top left of the object, then after setting the top left of the object, opined the mouseLoc to the object again. Do the same with left, and also with bottom and right if need be. 

Bob S


> On Apr 7, 2020, at 12:24 PM, Roger Guay via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Hi all, 
> 
> I know there must be a simple way to do this but it is escaping me at the moment. How can I move an object (grab me on mouseDown) and have it snap to a grid (square on a board game) on mouseUp?
> 
> Thanks much,
> 
> Roger



More information about the use-livecode mailing list