Select a block of tiles from tilemap by click and dragging I'm creating my first game in Godot 3.1, a top down 2D sim game where you can build rooms on a space station. I am using a tileset I created inside a TileMap node. I placed a script inside the node that checks for the mouse position in the world, converts it into a tilemap coordinate, then loads a tile into that tilemap coordinate. func input(event) if (event is InputEventMouse) var button event.get button mask() if (button 1) var tile pos world to map(event.position) var name tileset.tile get name(0) set cellv(tile pos, tileset.find tile by name(name)) Works like a champ! As long as the left mouse button is held down, any tile the mouse pointer touches is filled with the tile from the tileset. Now I am trying to expand this function so that I can click the world and drag across several tiles to form a rectangle or square, then have all of the tiles inside the selected area filled with the selected tile. func input(event) if (event is InputEventMouse) var button event.get button mask() if (button 1) var tile pos world to map(event.position) if (dragStart Vector2( 1, 1)) dragStart tile pos var name tileset.tile get name(0) if (dragStart ! Vector2( 1, 1) amp amp dragStart ! tile pos) var newX dragStart.x tile pos.x var newY dragStart.y tile pos.y while (newX ! 0 amp amp newY ! 0) var next Vector2( 1, 1) if newX gt 0 next Vector2(dragStart.x 1,dragStart.y) newX newX 1 elif newX lt 0 next Vector2(dragStart.x 1,dragStart.y) newX newX 1 elif newX 0 if newY gt 0 next Vector2(dragStart.x,dragStart.y 1) newY newY 1 elif newY lt 0 next Vector2(dragStart.x,dragStart.y 1) newY newY 1 print(next) set cellv(next, tileset.find tile by name(name)) else dragStart Vector2( 1, 1) However, it seems to only load some of the tiles and functions sporadically. Am I not understanding how the system iterates through the while loop or am I missing something else?