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; UMBinBegin = 14;
UMBinEnd = 513; UMBinEnd = 513;
bassThresholdCalcRange = thresholdRangeCalc(0.28f); bassThresholdCalcRange = thresholdRangeCalc(0.27f);
UMThresholdCalcRange = thresholdRangeCalc(0.4f); UMThresholdCalcRange = thresholdRangeCalc(0.4f);
Gdx.app.debug("Read freq", String.valueOf(audioData.getFormat().getSampleRate())); Gdx.app.debug("Read freq", String.valueOf(audioData.getFormat().getSampleRate()));

View File

@ -80,10 +80,11 @@ public class GamePlayMap {
public MapWindowData getCurrentWindowBasedOnIndex() { public MapWindowData getCurrentWindowBasedOnIndex() {
if (index != musicData.getReadIndex()) { if (index != musicData.getReadIndex()) {
index = musicData.getReadIndex(); index = musicData.getReadIndex();
return spawnList[index]; if (index < spawnList.length) {
} else { return spawnList[index];
return null; }
} }
return null;
} }
public int getIndex() { 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 || UMPeaks.get(index) != 0) {
if (bassPeaks.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 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: //If bass peak is greater than the bass peak average, then:
int normalIndexPos = map.setIndex((int) (map.getIndex() - windowPerSecond*1.5f)); int normalIndexPos = map.setIndex((int) (map.getIndex() - windowPerSecond*1.5f));
float waitTime = 1.5f; float waitTime = 1.5f;
@ -70,11 +70,13 @@ public class RhythmMapAlgorithm implements Runnable {
esi = map.addEntity(EntityIndex.VOID_CIRCLE); esi = map.addEntity(EntityIndex.VOID_CIRCLE);
esi.parameters.put("warningTime", waitTime); esi.parameters.put("warningTime", waitTime);
esi.parameters.put("endRadius", endRadius); 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("x", rand.nextFloat()*Main.GAME_AREA_WIDTH);
esi.parameters.put("y", rand.nextFloat()*Main.GAME_AREA_HEIGHT); esi.parameters.put("y", rand.nextFloat()*Main.GAME_AREA_HEIGHT);
map.setIndex(normalIndexPos); map.setIndex(normalIndexPos);
} else {
} }
} }

View File

@ -46,12 +46,12 @@ public class CollisionDetector {
//Play FX; //Play FX;
if (ally.playCollideSFX() && enemy.playCollideSFX()) { 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()) { if (ally.playCollidePFX() && enemy.playCollidePFX()) {
PooledEffect currentPFX; PooledEffect currentPFX;
currentPFX = explosionEffectPool.obtain(); 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); effects.add(currentPFX);
} }

View File

@ -138,16 +138,18 @@ public class Entity extends Actor implements Poolable {
center.set(getX() + getWidth()/2f, getY() + getHeight()/2f); center.set(getX() + getWidth()/2f, getY() + getHeight()/2f);
if (update) { if (update) {
if (simple) { updatePositionData();
sprite.setPosition(getX(), getY()); }
hitbox.setPosition(getX(), getY()); }
} else {
sprite.setCenter(center.x, center.y); public void updatePositionData() {
hitbox.setCenter(center); if (simple) {
sprite.setOriginCenter(); sprite.setPosition(getX(), getY());
sprite.setRotation(angle); 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 { } else {
endRadius = -1f; endRadius = -1f;
if (currentRadius > 0) { if (currentRadius > 0) {
growCurrentRadius(delta*-2f*growthRate); growCurrentRadius(delta*-growthRate);
} else { } else {
done = true; done = true;
} }

View File

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