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
* Computes the trajectory of an Arrow,
* given its initial conditions.

View file

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

View file

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