How do I drag sprites by events.
If you want the position of your sprites to constantly snap to a grid as you drag them, then you can set the position of the sprites every tick to something like this:
X: round(Sprite.X / TileWidth) * TileWidth
Y: round(Sprite.Y / TileHeight) * TileHeight
TileWidth and TileHeight being whatever size you want your grid squares to be.
Alternatively, if you want smooth dragging, but for the final positions to be snapped to a grid, you can set the sprite's position to the above formula upon the object being dropped.
Develop games in your browser. Powerful, performant & highly capable.
Thank you, it worked!