From 322808cc6d2a2da33d1214a0d6ef23368cc82de8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Thu, 13 May 2021 20:18:48 +0200 Subject: [PATCH] fix: hide some debug lines when not needed --- core/src/sagittarius/model/Arrow.java | 13 +++++++------ core/src/sagittarius/view/GameScreen.java | 4 ++-- core/src/sagittarius/view/SettingsScreen.java | 1 - 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/src/sagittarius/model/Arrow.java b/core/src/sagittarius/model/Arrow.java index 74567a9..d3f375e 100644 --- a/core/src/sagittarius/model/Arrow.java +++ b/core/src/sagittarius/model/Arrow.java @@ -98,9 +98,11 @@ public class Arrow extends EntityQuad { @Override public void drawDebug(ShapeRenderer shapes) { super.drawDebug(shapes); - if (getStage() != null) shapes.setColor(getStage().getDebugColor()); - for (Actor actor : GameScreen.attractors.getChildren()) { - shapes.line(getX(), getY(), actor.getX(), actor.getY()); + if (!landed) { + if (getStage() != null) shapes.setColor(getStage().getDebugColor()); + for (Actor actor : GameScreen.attractors.getChildren()) { + shapes.line(getX(), getY(), actor.getX(), actor.getY()); + } } } @@ -193,7 +195,7 @@ public class Arrow extends EntityQuad { } } - private boolean hasHit() { // doesn't work + private boolean hasHit() { for (Actor actor : GameScreen.players.getChildren()) { Player player = (Player) actor; if (player == GameScreen.playerCurrent) continue; @@ -213,14 +215,13 @@ public class Arrow extends EntityQuad { * @return an array of vertices describing the trajectory of the Arrow. */ static Trajectory computeTrajectory(float angle, float power, Player shooter, int iterations, float timeStep) { - Trajectory traj = new Trajectory(iterations); + Trajectory traj = new Trajectory(iterations); // TODO: not optimal Arrow dummyArrow = new Arrow(angle, power, shooter, true); for (int i = 0; i < iterations; i++) { dummyArrow.integrationVerlet(timeStep); traj.add(dummyArrow.getPosition()); if ( dummyArrow.hasLanded() || dummyArrow.hasHit() ) { break; } } - return traj; } diff --git a/core/src/sagittarius/view/GameScreen.java b/core/src/sagittarius/view/GameScreen.java index 06d828e..8e317b6 100644 --- a/core/src/sagittarius/view/GameScreen.java +++ b/core/src/sagittarius/view/GameScreen.java @@ -25,10 +25,10 @@ public class GameScreen extends BaseScreen implements InputProcessor { private static Vector3 unprojectedCursor; public static Vector2 worldCursor; - // Groups // TODO: move this in SagittariusGame ? + // Groups public static Group attractors; public static Group arrows; - public static Group players; + public static Group players; // TODO: move this in SagittariusGame ? // turn system stuff public static int playerIndex; diff --git a/core/src/sagittarius/view/SettingsScreen.java b/core/src/sagittarius/view/SettingsScreen.java index 77e5dc9..bd89412 100644 --- a/core/src/sagittarius/view/SettingsScreen.java +++ b/core/src/sagittarius/view/SettingsScreen.java @@ -11,7 +11,6 @@ import com.kotcrab.vis.ui.widget.VisTextButton; import com.kotcrab.vis.ui.widget.spinner.SimpleFloatSpinnerModel; import com.kotcrab.vis.ui.widget.spinner.Spinner; - import sagittarius.SagittariusGame; public class SettingsScreen extends BaseScreen {