game screen fixed issue where laser is first rendered then drawn, more tuning work

This commit is contained in:
Harrison Deng 2017-07-29 02:21:12 -05:00
parent e30cb93545
commit c9f580d695
7 changed files with 30 additions and 26 deletions

View File

@ -73,7 +73,7 @@ public class AudioAnalyzer {
UMBinBegin = 14;
UMBinEnd = 513;
bassThresholdCalcRange = thresholdRangeCalc(0.28f);
bassThresholdCalcRange = thresholdRangeCalc(0.27f);
UMThresholdCalcRange = thresholdRangeCalc(0.4f);
Gdx.app.debug("Read freq", String.valueOf(audioData.getFormat().getSampleRate()));

View File

@ -80,10 +80,11 @@ public class GamePlayMap {
public MapWindowData getCurrentWindowBasedOnIndex() {
if (index != musicData.getReadIndex()) {
index = musicData.getReadIndex();
return spawnList[index];
} else {
return null;
if (index < spawnList.length) {
return spawnList[index];
}
}
return null;
}
public int getIndex() {

View File

@ -61,7 +61,7 @@ public class RhythmMapAlgorithm implements Runnable {
if (bassPeaks.get(index) != 0 || UMPeaks.get(index) != 0) {
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 (index > 1.5*windowPerSecond && bassPeaks.get(index) >= avgBass) {
if (index > 1.5*windowPerSecond && bassPeaks.get(index) > avgBass) {
//If bass peak is greater than the bass peak average, then:
int normalIndexPos = map.setIndex((int) (map.getIndex() - windowPerSecond*1.5f));
float waitTime = 1.5f;
@ -70,11 +70,13 @@ public class RhythmMapAlgorithm implements Runnable {
esi = map.addEntity(EntityIndex.VOID_CIRCLE);
esi.parameters.put("warningTime", waitTime);
esi.parameters.put("endRadius", endRadius);
esi.parameters.put("growthRate", endRadius/(avgSPB*0.7f));
esi.parameters.put("growthRate", endRadius/(avgSPB*0.8f));
esi.parameters.put("x", rand.nextFloat()*Main.GAME_AREA_WIDTH);
esi.parameters.put("y", rand.nextFloat()*Main.GAME_AREA_HEIGHT);
map.setIndex(normalIndexPos);
} else {
}
}

View File

@ -46,12 +46,12 @@ public class CollisionDetector {
//Play FX;
if (ally.playCollideSFX() && enemy.playCollideSFX()) {
explosionSFX.play(prefs.getFloat("fx vol"), 1f, (enemy.getX()/Main.GAME_AREA_WIDTH)-0.55f);
explosionSFX.play(prefs.getFloat("fx vol")/100f, 1f, (enemy.getX()/Main.GAME_AREA_WIDTH));
}
if (ally.playCollidePFX() && enemy.playCollidePFX()) {
PooledEffect currentPFX;
currentPFX = explosionEffectPool.obtain();
currentPFX.setPosition(enemy.getX() + enemy.getWidth()/2f, enemy.getY() + enemy.getHeight()/2f);
currentPFX.setPosition(ally.getX() + ally.getWidth()/2f, ally.getY() + ally.getHeight()/2f);
effects.add(currentPFX);
}

View File

@ -138,16 +138,18 @@ public class Entity extends Actor implements Poolable {
center.set(getX() + getWidth()/2f, getY() + getHeight()/2f);
if (update) {
if (simple) {
sprite.setPosition(getX(), getY());
hitbox.setPosition(getX(), getY());
} else {
sprite.setCenter(center.x, center.y);
hitbox.setCenter(center);
sprite.setOriginCenter();
sprite.setRotation(angle);
}
updatePositionData();
}
}
public void updatePositionData() {
if (simple) {
sprite.setPosition(getX(), getY());
hitbox.setPosition(getX(), getY());
} else {
sprite.setCenter(center.x, center.y);
hitbox.setCenter(center);
sprite.setRotation(angle);
}
}

View File

@ -73,7 +73,7 @@ public class VoidCircle extends Entity {
} else {
endRadius = -1f;
if (currentRadius > 0) {
growCurrentRadius(delta*-2f*growthRate);
growCurrentRadius(delta*-growthRate);
} else {
done = true;
}

View File

@ -92,6 +92,7 @@ public class GameScreen extends ScreenAdapter {
public void render(float delta) {
Gdx.gl.glClearColor(0f, 0f, 0f, 0f);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
//Background stuff should literally span the whole screen so no matrice stuff
bgBatch.begin();
if (bgShader != null) {
bgBatch.setShader(bgShader);
@ -104,22 +105,20 @@ public class GameScreen extends ScreenAdapter {
bgBatch.draw(background, 0f, 0f, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
bgBatch.end();
gameArea.getViewport().apply();
gameArea.draw();
gameHUD.getViewport().apply();
gameHUD.draw();
//actual game and hud
if (!gameHUD.isPaused()) {
gameHUD.setScore(gameArea.getScore());
gameArea.act(delta);
if (gameArea.getPolyjet().isDead()) {
end(false);
}
gameHUD.act(delta);
}
gameArea.getViewport().apply();
gameArea.draw();
gameHUD.getViewport().apply();
gameHUD.draw();
if (!music.getPlaybackMusic().isPlaying()) {
end(true);
}