private void prepareSpawn(){
        if (time % spawnRate == 0){
            if (maxSpawnCount > spawnCount){
                spawn(mobsToSpawn);
                spawnCount++;
                wp.setLeft (maxSpawnCount - spawnCount);
            }
        }

        if (level % 10 == 0){
            s.stopAmbient();
            s.playBoss();
        }else{
            s.stopBoss();
            s.playAmbient();
        }

        if (maxSpawnCount <= spawnCount && mobs.size() == 0){
            levelStart = false;
            spawnCount = 0;
            time = 0;
            level++;
            if (level == 51){
                winGame(); 
                return;
            }
            numMobs = data.getCurrentMaxSpawn();
            numCreeps = 0;
            ui.setWaveData (0, nextElement, level);

            List <Tower> tempTower = getObjects (Tower.class);
            for (Tower t: tempTower){
                t.setActive (false);
            }
            wp.reset();
        }
    }