public static void update() {
		if (nextWave <= 0) {
			if (monsters.size() > 0) {
				new Thread() {
					@Override
					public void run() {
						EnumMap<Monster, Integer> monsters = WaveManager.monsters.clone();
						WaveManager.monsters.clear();
						int leftLength = 0;
						int rightLength = 0;
						
						int space = Tile.SIZE * 2 - wave;
						space = space < Tile.SIZE ? Tile.SIZE : space;
						
						for (Monster monster : monsters.keySet()) {
							for (int i = 0; i < monsters.get(monster); i++) {
								try {
									boolean left = Math.random() < 0.5;
									
									int x = left ? -leftLength * space : Game.world.width + rightLength * space;
									Entity e = (Entity) monster.getCreatureClass().getConstructor(int.class, int.class).newInstance(x, 0);
									int y = Game.world.height / 2 - e.getBump(false).y + e.getBump(false).height;
									e.setY(y);
									
									Game.world.addEntity2(e, false);
									
									if (left) leftLength++;
									else rightLength++;
								} catch (Exception e1) {
									e1.printStackTrace();
								}
							}
							
							leftLength /= 2;
							rightLength /= 2;
						}
					}
				}.start();
			} else {
				if (stageClear()) generateNextWave();
			}
		}
	}