fix: hide some debug lines when not needed

This commit is contained in:
Laureηt 2021-05-13 20:18:48 +02:00
parent 93f89c3e64
commit 322808cc6d
3 changed files with 9 additions and 9 deletions

View file

@ -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;
}

View file

@ -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;

View file

@ -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 {