diff --git a/core/src/com/ninjaghost/gamejam/ChronoFloraGame.java b/core/src/com/ninjaghost/gamejam/ChronoFloraGame.java index 42005c5..27096e2 100644 --- a/core/src/com/ninjaghost/gamejam/ChronoFloraGame.java +++ b/core/src/com/ninjaghost/gamejam/ChronoFloraGame.java @@ -232,22 +232,8 @@ public void create () { @Override public void render () { - - // this was used to test the FPS graph -// Random rnd = new Random(); -// int rndMin = 1; -// int rndMax = 500; -// if(rnd.nextInt(rndMax) < 50) { -// try { -// Thread.sleep(rnd.nextInt(rndMax - rndMin) + rndMin); -// } catch (InterruptedException e) { -// throw new RuntimeException(e); -// } -// } - // remove things out of circulation cleanupThingsForDeletion(); - rectanglesToRender.clear(); if(Gdx.input.isKeyJustPressed(Input.Keys.GRAVE)) { @@ -272,8 +258,6 @@ public void render () { ImGui.plotLines("Framerate", data, data.length, 0, "", 0, 60, 400, 100, 4); - - // This chunk is all about setting a new target camera zoom based on player movement float newTargetCameraZoom = getNewTargetCameraZoom(); cameraTargetZoomFactor[0] = newTargetCameraZoom; @@ -284,11 +268,9 @@ public void render () { // Control camera focus camera.position.set(new Vector3(cameraFocus[0], cameraFocus[1], 0)); - camera.update(); - // Update non-player entities for(Plant p : plants) { p.update(Gdx.graphics.getDeltaTime()); @@ -394,9 +376,6 @@ public void render () { // io.setKeyAlt(Gdx.input.isKeyPressed(Input.Keys.ALT_LEFT) || Gdx.input.isKeyPressed(Input.Keys.ALT_RIGHT)); // io.setKeySuper(Gdx.input.isKeyPressed(Input.Keys.SYM)); - - - ImGui.text("Player"); ImGui.text("- Inventory"); for (PlantItem plant : playerInventory) { @@ -413,8 +392,6 @@ public void render () { ImGui.sliderFloat("gravity", GameSettingsState.itemGravityFactor, -100f, 100f); ImGui.sliderFloat("jump", GameSettingsState.itemJumpFactor, -50f, 50f); ImGui.sliderFloat("speed", GameSettingsState.itemSpeedFactor, 0.01f, 50f); - ImGui.checkbox("reverse gravity", GameSettingsState.reverseGravity); - ImGui.checkbox("reverse move input", GameSettingsState.reverseInput); ImGui.end(); diff --git a/core/src/com/ninjaghost/gamejam/GameSettingsState.java b/core/src/com/ninjaghost/gamejam/GameSettingsState.java index f4e5443..df9ef92 100644 --- a/core/src/com/ninjaghost/gamejam/GameSettingsState.java +++ b/core/src/com/ninjaghost/gamejam/GameSettingsState.java @@ -8,8 +8,6 @@ public class GameSettingsState { public static float[] itemGravityFactor = new float[] { -90f }; public static float[] itemJumpFactor = new float[] { -40f }; public static float[] itemSpeedFactor = new float[] { 0.5f }; - public static boolean reverseGravity = true; - public static boolean reverseInput = false; public static boolean showGameOver = false; diff --git a/core/src/com/ninjaghost/gamejam/entities/PlantItem.java b/core/src/com/ninjaghost/gamejam/entities/PlantItem.java index a1d0768..2e50ce3 100644 --- a/core/src/com/ninjaghost/gamejam/entities/PlantItem.java +++ b/core/src/com/ninjaghost/gamejam/entities/PlantItem.java @@ -7,7 +7,8 @@ import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; import com.ninjaghost.gamejam.GameSettingsState; -import imgui.ImGui; + +import java.util.concurrent.ThreadLocalRandom; public class PlantItem { @@ -28,15 +29,12 @@ public enum MODE { COLLECTABLE, INVENTORY } // Collectable Item Mode Stuff boolean isCollectable = false; - float gravityVelocityFactor = 980f; float gravityVelocity = 0f; float isCollectableTimer = 0f; float animationTimer = 0f; float getIsCollectableTimerMax = 0.8f; float animationTimerMax = 0.8f; - - float[] gui_gravityVelocityFactor = new float[]{ 980f }; - float[] gui_gravityVelocity = new float[]{ 0f }; + float popHorizontalDirection = 4f; public PlantItem(int x, int y) { m_sprite = new Sprite(new Texture("plants/001_item.png")); @@ -86,29 +84,27 @@ public void update(float delta) { if(!isCollectable && m_mode == MODE.COLLECTABLE && isCollectableTimer < getIsCollectableTimerMax) { // item is a collectable item but we aren't quite collectable yet isCollectableTimer += delta; -// animationTimer += delta; - - } if(!isCollectable && m_mode == MODE.COLLECTABLE && !isSpawnAnimationDone) { boolean start = false; if(animationTimer <= 0f) { start = true; + // starting out we want a solid set for velocity gravityVelocity = GameSettingsState.itemJumpFactor[0]; + popHorizontalDirection = ThreadLocalRandom.current().nextFloat(-8f, 8f); } // do the next frame of the bounce animation here animationTimer += delta; // we're going to do a kind of bounce effect from the location registered - // but for now let's just put it in the "spot" it's going to wind up at - if(!start) { gravityVelocity += -GameSettingsState.itemGravityFactor[0] * delta; } -// m_position.x += 2f * delta; + + m_position.x += popHorizontalDirection * delta; m_position.y += gravityVelocity * delta; m_sprite.setPosition(m_position.x, m_position.y); } @@ -119,7 +115,6 @@ public void update(float delta) { if(!isCollectable && m_mode == MODE.COLLECTABLE && isCollectableTimer >= getIsCollectableTimerMax) { isCollectable = true; - }