public void drawMap(Graphics g) {
        for (int r = 0; r < map.length; r++) {
            for (int k = 0; k < map[0].length; k++) {
                int x = k * GameObject.tileSize;
                int y = r * GameObject.tileSize;
                if (camera.intersects(x + GameObject.tileSize, y, 1, 1) || camera.intersects(x, y + GameObject.tileSize, 1, 1)
                        || camera.intersects(x - GameObject.tileSize, y, 1, 1) || camera.intersects(x + GameObject.tileSize, y + GameObject.tileSize, 1, 1)
                        || camera.intersects(x, y - GameObject.tileSize, 1, 1)) {

                    x -= (int) camera.getX();
                    y -= (int) camera.getY();
                    if (map[r][k] == 1) {
                        g.drawImage(Tile.grass, x, y, GameObject.tileSize, GameObject.tileSize, null);
                    }
                    if (showGrid) {
                        g.setColor(Color.black);
                        g.drawRect(x, y, GameObject.tileSize, GameObject.tileSize);
                        g.drawString(r + "," + k, x + 32, y + 32);
                    }

                }
            }
        }

    }