As I’ve mentioned in a few posts, I’ve created an extension that divides the screen into a grid layout. You can then use that grid to place sprites, and to restrict their movement to coordinates in the grid. It uses mechanics similar to those found in the built-in Memory game or in John Park’s Re-MakeCode Racing Game.
Extension URL (for importing into your own games): https://github.com/robo-technical-group/pxt-arcade-grid.git
See it in action here:
API documentation is available here: https://github.com/robo-technical-group/pxt-arcade-grid/blob/master/api.md
Let me know if you find any errors or have any comments. Have fun!