Pretty much as above, the player can roam freely but can only place objects (with the space bar) on a 16x16 grid (that the player can't see, but can see the object snapping to the nearest grid when the player moves.
Thank you.
Develop games in your browser. Powerful, performant & highly capable.
If there's a tilemap, you can use Tilemap.snapX(player.x) and Tilemap.snapY(player.y) expressions.
Or use these formulas:
x = int(player.x/16)*16+8
y = int(player.y/16)*16+8