progress on debug screen and minor error resolved with map gen

This commit is contained in:
2017-07-11 23:33:25 -05:00
parent 27757f0024
commit 2cd752f25c
14 changed files with 66 additions and 19 deletions

View File

@@ -8,8 +8,12 @@ import com.badlogic.gdx.utils.FloatArray;
import zero1hd.polyjet.Polyjet;
import zero1hd.polyjet.audio.AudioAnalyzer;
import zero1hd.polyjet.entity.Entities;
import zero1hd.polyjet.util.MiniEvents;
import zero1hd.polyjet.util.MiniSender;
public class RhythmMapAlgorithm implements Runnable {
private MiniSender sender;
private FloatArray bassPeaks;
private FloatArray UMPeaks;
private FloatArray overlappedPeaks;
@@ -23,6 +27,8 @@ public class RhythmMapAlgorithm implements Runnable {
private volatile int progress;
public RhythmMapAlgorithm(AudioAnalyzer analyzer, float speedMod, float healthMod) {
sender = new MiniSender();
bassPeaks = analyzer.getBassPeaks();
UMPeaks = analyzer.getUMPeaks();
overlappedPeaks = analyzer.getOverlappedPeaks();
@@ -41,7 +47,7 @@ public class RhythmMapAlgorithm implements Runnable {
for (int index = 0; index < bassPeaks.size; index++) {
if (bassPeaks.get(index) != 0 || UMPeaks.get(index) != 0) {
int warningTime = (int) ((3/speedMod)*windowPerSecond);
if (overlappedPeaks.get(index + warningTime) != 0) {
if ((index+warningTime <= bassPeaks.size) && overlappedPeaks.get(index + warningTime) != 0) {
//TODO basic void circle spawning
float endRadius = overlappedPeaks.get(index+3)*Polyjet.GAME_AREA_WIDTH;
@@ -73,6 +79,8 @@ public class RhythmMapAlgorithm implements Runnable {
}
progress = (int) (100f*index/bassPeaks.size);
sender.send(MiniEvents.MAPGEN_ITERATED);
}
map.endBuild();
}
@@ -84,4 +92,8 @@ public class RhythmMapAlgorithm implements Runnable {
public synchronized int getProgress() {
return progress;
}
public MiniSender getSender() {
return sender;
}
}