From c9f580d695f8068daebf4808a6743499b609e4e8 Mon Sep 17 00:00:00 2001 From: Recrown Date: Sat, 29 Jul 2017 02:21:12 -0500 Subject: [PATCH] game screen fixed issue where laser is first rendered then drawn, more tuning work --- .../zero1hd/polyjet/audio/AudioAnalyzer.java | 2 +- .../polyjet/audio/map/GamePlayMap.java | 7 +++--- .../polyjet/audio/map/RhythmMapAlgorithm.java | 6 +++-- .../polyjet/entity/CollisionDetector.java | 4 ++-- core/src/zero1hd/polyjet/entity/Entity.java | 22 ++++++++++--------- .../polyjet/entity/enemies/VoidCircle.java | 2 +- .../zero1hd/polyjet/screens/GameScreen.java | 13 +++++------ 7 files changed, 30 insertions(+), 26 deletions(-) diff --git a/core/src/zero1hd/polyjet/audio/AudioAnalyzer.java b/core/src/zero1hd/polyjet/audio/AudioAnalyzer.java index a1fb3db..8661b8f 100755 --- a/core/src/zero1hd/polyjet/audio/AudioAnalyzer.java +++ b/core/src/zero1hd/polyjet/audio/AudioAnalyzer.java @@ -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())); diff --git a/core/src/zero1hd/polyjet/audio/map/GamePlayMap.java b/core/src/zero1hd/polyjet/audio/map/GamePlayMap.java index 34a6c36..f2ab9d5 100755 --- a/core/src/zero1hd/polyjet/audio/map/GamePlayMap.java +++ b/core/src/zero1hd/polyjet/audio/map/GamePlayMap.java @@ -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() { diff --git a/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java b/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java index f8e0dab..ca01e07 100755 --- a/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java +++ b/core/src/zero1hd/polyjet/audio/map/RhythmMapAlgorithm.java @@ -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 { + } } diff --git a/core/src/zero1hd/polyjet/entity/CollisionDetector.java b/core/src/zero1hd/polyjet/entity/CollisionDetector.java index a291b2e..1e9b341 100755 --- a/core/src/zero1hd/polyjet/entity/CollisionDetector.java +++ b/core/src/zero1hd/polyjet/entity/CollisionDetector.java @@ -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); } diff --git a/core/src/zero1hd/polyjet/entity/Entity.java b/core/src/zero1hd/polyjet/entity/Entity.java index 40dbad5..049755c 100755 --- a/core/src/zero1hd/polyjet/entity/Entity.java +++ b/core/src/zero1hd/polyjet/entity/Entity.java @@ -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); } } diff --git a/core/src/zero1hd/polyjet/entity/enemies/VoidCircle.java b/core/src/zero1hd/polyjet/entity/enemies/VoidCircle.java index 2dff1be..864888e 100755 --- a/core/src/zero1hd/polyjet/entity/enemies/VoidCircle.java +++ b/core/src/zero1hd/polyjet/entity/enemies/VoidCircle.java @@ -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; } diff --git a/core/src/zero1hd/polyjet/screens/GameScreen.java b/core/src/zero1hd/polyjet/screens/GameScreen.java index 04f3eb8..b892aff 100755 --- a/core/src/zero1hd/polyjet/screens/GameScreen.java +++ b/core/src/zero1hd/polyjet/screens/GameScreen.java @@ -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); }