This is probably something really simple, but I can't seem to figure it out.
I'm creating a map editor for my RPG, and I want the user to be able to drag objects like triggers around. This is all working fine, but I want to include a 'snap to grid' feature.
This is my code for moving the objects around:
Previously, when the map editor was just a simple 'drop the tiles' affair, I used the following to snap the cursor to a grid:
I'm creating a map editor for my RPG, and I want the user to be able to drag objects like triggers around. This is all working fine, but I want to include a 'snap to grid' feature.
This is my code for moving the objects around:
Case EVENT_MOUSEMOVE If Mouse_Down = True And Selection <> Null Selection.X = Selection.X + Mouse.MouseXSpeed(EventX()) Selection.Y = Selection.Y + Mouse.MouseYSpeed(EventY()) EndIf Mouse.Update(EventX(), EventY())I'm using this by Gfk for the MouseXSpeed/MouseYSpeed functionality.
Previously, when the map editor was just a simple 'drop the tiles' affair, I used the following to snap the cursor to a grid:
MX = EventX() - EventX() Mod 32 MY = EventY() - EventY() Mod 32I can't work out how to make this work with what I'm doing now... any ideas? I'd really appreciate any help anyone can give!