fix: hide some debug lines when not needed
This commit is contained in:
parent
93f89c3e64
commit
322808cc6d
|
@ -98,11 +98,13 @@ public class Arrow extends EntityQuad {
|
||||||
@Override
|
@Override
|
||||||
public void drawDebug(ShapeRenderer shapes) {
|
public void drawDebug(ShapeRenderer shapes) {
|
||||||
super.drawDebug(shapes);
|
super.drawDebug(shapes);
|
||||||
|
if (!landed) {
|
||||||
if (getStage() != null) shapes.setColor(getStage().getDebugColor());
|
if (getStage() != null) shapes.setColor(getStage().getDebugColor());
|
||||||
for (Actor actor : GameScreen.attractors.getChildren()) {
|
for (Actor actor : GameScreen.attractors.getChildren()) {
|
||||||
shapes.line(getX(), getY(), actor.getX(), actor.getY());
|
shapes.line(getX(), getY(), actor.getX(), actor.getY());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void draw(Batch batch, float parentAlpha) {
|
public void draw(Batch batch, float parentAlpha) {
|
||||||
|
@ -193,7 +195,7 @@ public class Arrow extends EntityQuad {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean hasHit() { // doesn't work
|
private boolean hasHit() {
|
||||||
for (Actor actor : GameScreen.players.getChildren()) {
|
for (Actor actor : GameScreen.players.getChildren()) {
|
||||||
Player player = (Player) actor;
|
Player player = (Player) actor;
|
||||||
if (player == GameScreen.playerCurrent) continue;
|
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.
|
* @return an array of vertices describing the trajectory of the Arrow.
|
||||||
*/
|
*/
|
||||||
static Trajectory computeTrajectory(float angle, float power, Player shooter, int iterations, float timeStep) {
|
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);
|
Arrow dummyArrow = new Arrow(angle, power, shooter, true);
|
||||||
for (int i = 0; i < iterations; i++) {
|
for (int i = 0; i < iterations; i++) {
|
||||||
dummyArrow.integrationVerlet(timeStep);
|
dummyArrow.integrationVerlet(timeStep);
|
||||||
traj.add(dummyArrow.getPosition());
|
traj.add(dummyArrow.getPosition());
|
||||||
if ( dummyArrow.hasLanded() || dummyArrow.hasHit() ) { break; }
|
if ( dummyArrow.hasLanded() || dummyArrow.hasHit() ) { break; }
|
||||||
}
|
}
|
||||||
|
|
||||||
return traj;
|
return traj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,10 @@ public class GameScreen extends BaseScreen implements InputProcessor {
|
||||||
private static Vector3 unprojectedCursor;
|
private static Vector3 unprojectedCursor;
|
||||||
public static Vector2 worldCursor;
|
public static Vector2 worldCursor;
|
||||||
|
|
||||||
// Groups // TODO: move this in SagittariusGame ?
|
// Groups
|
||||||
public static Group attractors;
|
public static Group attractors;
|
||||||
public static Group arrows;
|
public static Group arrows;
|
||||||
public static Group players;
|
public static Group players; // TODO: move this in SagittariusGame ?
|
||||||
|
|
||||||
// turn system stuff
|
// turn system stuff
|
||||||
public static int playerIndex;
|
public static int playerIndex;
|
||||||
|
|
|
@ -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.SimpleFloatSpinnerModel;
|
||||||
import com.kotcrab.vis.ui.widget.spinner.Spinner;
|
import com.kotcrab.vis.ui.widget.spinner.Spinner;
|
||||||
|
|
||||||
|
|
||||||
import sagittarius.SagittariusGame;
|
import sagittarius.SagittariusGame;
|
||||||
|
|
||||||
public class SettingsScreen extends BaseScreen {
|
public class SettingsScreen extends BaseScreen {
|
||||||
|
|
Loading…
Reference in a new issue