fixed dumb math mistake and changes to map gen index control

This commit is contained in:
2017-07-26 02:24:23 -05:00
parent e6b3960e7e
commit 013e3d7d99
8 changed files with 81 additions and 48 deletions

View File

@@ -57,34 +57,51 @@ public class RhythmMapAlgorithm implements Runnable {
map.beginBuild();
for (int index = 0; index < bassPeaks.size; index++) {
if (bassPeaks.get(index) != 0 || UMPeaks.get(index) != 0) {
//If there is a value of some sorts that is not zero, we generate some beat for the map
if (bassPeaks.get(index) >= avgBass) {
float warningTime = map.goBack((int) (windowPerSecond*1.5f))/windowPerSecond;
float endRadius = (bassPeaks.get(index)/bassMax)*(Main.GAME_AREA_HEIGHT/4f);
map.addToMap(Entities.VOID_CIRCLE,
endRadius,
rand.nextFloat()*Main.GAME_AREA_WIDTH,
rand.nextFloat()*Main.GAME_AREA_HEIGHT,
endRadius/(avgSPB*0.7f),
warningTime
);
map.resetIndex();
if (bassPeaks.get(index) != 0) {
//If there is a value of some sorts that is not zero, we generate some beat for the map
if (bassPeaks.get(index) >= avgBass) {
//If bass peak is greater than the bass peak average, then:
int indexMoved = map.goBack((int) (windowPerSecond*1.5f));
float waitTime = indexMoved/windowPerSecond;
float endRadius = (bassPeaks.get(index)/bassMax)*(Main.GAME_AREA_HEIGHT/4f);
map.addToMap(Entities.VOID_CIRCLE,
endRadius,
rand.nextFloat()*Main.GAME_AREA_WIDTH,
rand.nextFloat()*Main.GAME_AREA_HEIGHT,
endRadius/(avgSPB*0.7f),
waitTime
);
map.goForward(indexMoved);
}
}
if (UMPeaks.get(index) >= avgUM) {
int spawnLocations = (Main.GAME_AREA_WIDTH-8)/8;
map.addToMap(Entities.BAR,
MathUtils.round(rand.nextFloat()*spawnLocations)*8,
(8f/avgSPB)*speedMod);
} else {
if (UMPeaks.get(index) != 0) {
if (UMPeaks.get(index) != 0) {
if (UMPeaks.get(index) >= avgUM) {
//If upper midrange peaks are greater than average, the:
int spawnLocations = (Main.GAME_AREA_WIDTH-8)/8;
map.addToMap(Entities.BAR,
MathUtils.round(rand.nextFloat()*spawnLocations)*8,
(8f/avgSPB)*speedMod);
} else {
float xSpawnLocation = (rand.nextFloat()*(Main.GAME_AREA_WIDTH-2))+1;
map.addToMap(Entities.PELLET,
xSpawnLocation,
Main.GAME_AREA_HEIGHT-0.25f,
140*rand.nextFloat()+110f,
140*rand.nextFloat()+110f,
(Main.GAME_AREA_HEIGHT/4f)/avgSPB);
}
}
if (overlappedPeaks.get(index) != 0) {
}
if (rand.nextFloat() < 0.15f) {
switch(rand.nextInt(10)) {
case 0:
break;
}
}
} else {
map.addNullToMap();
}