This project is an example of an editable tile grid that can expand infinitely in any direction. Comments explaining the code can be found inside. Controls: Use the mouse to draw. Press the arrow keys to move the camera. Press 0, 1, 2, or 3 to change the paint brush's colour.
If you have any questions, feel free to ask! I optimized it with a hash table which allows to save only the tiles that are not empty. It allows faster grid edits when a tile is placed outside the previous version's bounds. For an extreme example if you place a cell in x=1000,y=1000 the previous version would have added 1 000 000 cells instead of 1 now (which by the way is impossible due to scratch's limitations).