public void initLevel() {

		// Iterates through all the fields and creates the elements
		for (int i = 0; i < grid.length; i++) {
			for (int n = 0; n < grid[i].length; n++) {
				switch (grid[i][n].getState()) {
				case PLAYER:
					Player p = new Player();
					this.add(p);
					field[i][n] = p;
					break;
				case WALL:

					Wall w = new Wall();
					this.add(w);
					field[i][n] = w;
					break;
				case GOAL:

					Goal g = new Goal();
					this.add(g);
					field[i][n] = g;
					break;
				case EMPTY:
					Floor f = new Floor();
					this.add(f);
					field[i][n] = f;
					break;
				case DIAMOND:
					Diamond d = new Diamond();
					this.add(d);
					field[i][n] = d;
					break;
				case PLAYER_ON_GOAL:
					PlayerOnGoal pl = new PlayerOnGoal();
					this.add(pl);
					field[i][n] = pl;
					break;
				case COMPLETED:
					Finish finish = new Finish();
					finish.setCompleted();
					this.add(finish);
					field[i][n] = finish;
					break;
				default:
					break;
				}
			}
		}
		repaint();
	}