private void updateLevel()
	{
		// Distance between the traps:
		int minDistance = 40;
		int maxDistance = 400;
		if (Math.abs(player.vel.x) > 1) {
			maxDistance *= Math.abs(player.vel.x / 2);
			minDistance *= Math.abs(player.vel.x);
		}
		
		int sinceLastUpdate = (int) Math.abs(mainCamera.position.x - lastCamera);
		
		if (sinceLastUpdate > minDistance) {
			if (sinceLastUpdate > maxDistance) {
				addTrap();
			} else if (Math.random() > 0.9) {
				addTrap();
			}
		}

		/*int i = 0;
		while (i < sinceLastUpdate) {
			// take a step.
			int step = (int) (Math.random() * (maxDistance - minDistance) + minDistance);
			i += step;
			
			Trap newTrap = new Trap(mainCamera.position.x + i + Main.WIDTH / 2);
			traps.add(newTrap);
		}*/
		
		
		// Remove old traps.
		for (int i = traps.size() - 1; i >= 0; i --) {
			if (traps.get(i).pos.x < mainCamera.position.x - Main.WIDTH / 2 - 50){
				traps.remove(i);
			}
		}
		
	}