I think I have found your problem:
simply change this:
to
simply change this:
Function place_tile() If MouseDown(KEY_MOUSELEFT) 'Below we devide a map position by the tile size to get the correct place on the array map[MouseX() / 32, MouseY() /32] = curtile EndIf End Function
to
Function place_tile() If MouseDown(KEY_MOUSELEFT) 'Below we devide a map position by the tile size to get the correct place on the array map[(MouseX()-mapstartX) / 32, (MouseY()-mapstartY) /32] = curtile EndIf End Function