public GameData getData() {
		// creating a new gamedata object
		GameData gd = new GameData();

		// setting the MP and gem
		gd.setMP(MagicPower.getMP());
		gd.setGem(gem);
		gd.setCounter(counter);

		// adding the enemies
		List<Enemy> enemyList = new ArrayList<Enemy>();

		for (Tile t : map) {
			if (t instanceof Road) {
				Road r = (Road) t;
				for (Enemy e : r.getEnemies()) {
					enemyList.add(e);
				}
			}
		}

		for (Enemy e : enemyList) {
			int[] pos = new int[2];
			pos[0] = map.indexOf(e.getRoad()) / size;
			pos[1] = map.indexOf(e.getRoad()) % size;
			gd.addEnemy(pos, e);
		}

		// adding the towers
		for (Tower t : towers) {
			int[] pos = new int[2];
			pos[0] = map.indexOf(t.getField()) / size;
			pos[1] = map.indexOf(t.getField()) % size;
			gd.addTower(pos, t);
		}

		// adding swamps
		for (Tile t : map) {
			if (t instanceof Swamp) {
				int[] pos = new int[2];
				pos[0] = map.indexOf(t) / size;
				pos[1] = map.indexOf(t) % size;
				gd.addSwamp(pos, (Swamp) t);
			}
		}

		return gd;
	}