fix: changed "playing" for "active"

This commit is contained in:
Laureηt 2021-04-13 21:57:53 +02:00
parent f57d2da53d
commit bcfdc1e5d5
3 changed files with 15 additions and 11 deletions

View file

@ -137,6 +137,10 @@ public class Arrow extends BaseActor {
} }
} }
private void verifyHittingPlayer() {
}
/** // TODO : pass directly an Arrow instead of 3 arguments /** // TODO : pass directly an Arrow instead of 3 arguments
* Computes the trajectory of an Arrow, * Computes the trajectory of an Arrow,
* given its initial conditions. * given its initial conditions.

View file

@ -11,7 +11,7 @@ public class Player extends BaseActor {
// ---------- ATTRIBUTEs ---------- // ---------- ATTRIBUTEs ----------
private Planet home; private Planet home;
private boolean playing; private boolean active;
// ---------- CONSTRUCTORs ---------- // ---------- CONSTRUCTORs ----------
@ -40,7 +40,7 @@ public class Player extends BaseActor {
public void act(float dt) { public void act(float dt) {
super.act(dt); super.act(dt);
if (playing) { if (active) {
if (Gdx.input.isKeyPressed(Keys.LEFT)) { if (Gdx.input.isKeyPressed(Keys.LEFT)) {
this.angle += 100.0f / home.getRadius(); this.angle += 100.0f / home.getRadius();
} }
@ -73,15 +73,15 @@ public class Player extends BaseActor {
* Change the active state of the {@link Player}. * Change the active state of the {@link Player}.
* @param bool true or false * @param bool true or false
*/ */
public void setPlaying(boolean bool) { public void setActive(boolean bool) {
playing = bool; active = bool;
} }
/** /**
* @return the active state of the {@link Player}. * @return the active state of the {@link Player}.
*/ */
public boolean isPlaying() { public boolean isActive() {
return playing; return active;
} }
} }

View file

@ -74,7 +74,7 @@ public class GameScreen extends BaseScreen {
// game turns // game turns
playerTurn = 0; playerTurn = 0;
player1.setPlaying(true); player1.setActive(true);
} }
@ -86,12 +86,12 @@ public class GameScreen extends BaseScreen {
worldCursor = new Vector2(unprojectedCursor.x, unprojectedCursor.y); worldCursor = new Vector2(unprojectedCursor.x, unprojectedCursor.y);
Player actualPlayer = (Player) players.getChild(playerTurn); Player actualPlayer = (Player) players.getChild(playerTurn);
if (actualPlayer.isPlaying()) { if (actualPlayer.isActive()) {
actualPlayer.setPlaying(true); actualPlayer.setActive(true);
playerTurn++; playerTurn++;
playerTurn %= players.getChildren().size; playerTurn %= players.getChildren().size;
actualPlayer = (Player) players.getChild(playerTurn); actualPlayer = (Player) players.getChild(playerTurn);
actualPlayer.setPlaying(false); actualPlayer.setActive(false);
} }
} }
@ -106,7 +106,7 @@ public class GameScreen extends BaseScreen {
players.removeActor(player); players.removeActor(player);
playerTurn %= players.getChildren().size; playerTurn %= players.getChildren().size;
Player actualPlayer = (Player) players.getChild(playerTurn); Player actualPlayer = (Player) players.getChild(playerTurn);
actualPlayer.setPlaying(true); actualPlayer.setActive(true);
} else { } else {
players.removeActor(player); players.removeActor(player);
} }