fix: changed a couple of methods
This commit is contained in:
parent
696735af14
commit
6b74d3ad7c
|
@ -35,7 +35,7 @@ public class Bow extends Actor {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------- METHODs ----------
|
// ---------- METHODs ----------
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void act(float dt) {
|
public void act(float dt) {
|
||||||
if (playing) {
|
if (playing) {
|
||||||
|
@ -79,34 +79,25 @@ public class Bow extends Actor {
|
||||||
power = MathUtils.clamp(aim.len(), 0, 1000);
|
power = MathUtils.clamp(aim.len(), 0, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates an Arrow according to the Bow's attributes.
|
* Generates an Arrow according to the Bow's attributes.
|
||||||
*
|
*
|
||||||
* @return an Arrow.
|
* @return an Arrow.
|
||||||
*/
|
*/
|
||||||
private Arrow getArrow() {
|
private Arrow getArrow() {
|
||||||
return new Arrow(angle, power, shooter);
|
return new Arrow(angle, power, shooter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indiquer que c'est a son tour de jouer.
|
* Change the active state of the {@link Bow}.
|
||||||
|
* @param bool true or false
|
||||||
*/
|
*/
|
||||||
public void startPlaying() {
|
public void setPlaying(boolean bool) {
|
||||||
playing = true;
|
playing = bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indique que ce n'est plus son tour de jouer.
|
* @return the active state of the {@link Bow}.
|
||||||
*/
|
|
||||||
public void stopPlaying() {
|
|
||||||
playing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Savoir si il est entrain de jouer.
|
|
||||||
*/
|
*/
|
||||||
public boolean isPlaying() {
|
public boolean isPlaying() {
|
||||||
return playing;
|
return playing;
|
||||||
|
|
|
@ -75,23 +75,16 @@ public class Player extends BaseActor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indiquer que c'est son tour de jouer.
|
* Change the active state of the {@link Player}.
|
||||||
|
* @param bool true or false
|
||||||
*/
|
*/
|
||||||
public void startPlaying() {
|
public void setPlaying(boolean bool) {
|
||||||
bow.startPlaying();
|
bow.setPlaying(bool);
|
||||||
playing = true;
|
playing = bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Indique la fin de son tour de jeu.
|
* @return the active state of the {@link Player}.
|
||||||
*/
|
|
||||||
public void stopPlaying() {
|
|
||||||
bow.stopPlaying();
|
|
||||||
playing = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Savoir si il est entrain de jouer.
|
|
||||||
*/
|
*/
|
||||||
public boolean isPlaying() {
|
public boolean isPlaying() {
|
||||||
return playing;
|
return playing;
|
||||||
|
|
|
@ -31,10 +31,10 @@ public class GameScreen extends BaseScreen {
|
||||||
|
|
||||||
// planets & moons
|
// planets & moons
|
||||||
attractors = new Group();
|
attractors = new Group();
|
||||||
|
|
||||||
Planet planet1 = new Planet(new Vector2(400, 400), 1000, 50, Color.BLUE);
|
Planet planet1 = new Planet(new Vector2(400, 400), 1000, 50, Color.BLUE);
|
||||||
attractors.addActor(planet1);
|
attractors.addActor(planet1);
|
||||||
|
|
||||||
Planet planet2 = new Planet(new Vector2(1400, 700), 1000, 100, Color.ORANGE);
|
Planet planet2 = new Planet(new Vector2(1400, 700), 1000, 100, Color.ORANGE);
|
||||||
attractors.addActor(planet2);
|
attractors.addActor(planet2);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public class GameScreen extends BaseScreen {
|
||||||
|
|
||||||
mainStage.addActor(players);
|
mainStage.addActor(players);
|
||||||
playerTurn = 0;
|
playerTurn = 0;
|
||||||
player1.startPlaying();
|
player1.setPlaying(true);
|
||||||
|
|
||||||
// arrows
|
// arrows
|
||||||
arrows = new Group();
|
arrows = new Group();
|
||||||
|
@ -81,16 +81,15 @@ public class GameScreen extends BaseScreen {
|
||||||
|
|
||||||
Player actualPlayer = (Player) players.getChild(playerTurn);
|
Player actualPlayer = (Player) players.getChild(playerTurn);
|
||||||
if (actualPlayer.isPlaying() && !actualPlayer.getBow().isPlaying()) {
|
if (actualPlayer.isPlaying() && !actualPlayer.getBow().isPlaying()) {
|
||||||
actualPlayer.stopPlaying();
|
actualPlayer.setPlaying(true);
|
||||||
playerTurn++;
|
playerTurn++;
|
||||||
playerTurn %= players.getChildren().size;
|
playerTurn %= players.getChildren().size;
|
||||||
actualPlayer = (Player) players.getChild(playerTurn);
|
actualPlayer = (Player) players.getChild(playerTurn);
|
||||||
actualPlayer.startPlaying();
|
actualPlayer.setPlaying(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void removePlayer(Player player) {
|
public void removePlayer(Player player) {
|
||||||
int index = players.getChildren().indexOf(player, true);
|
int index = players.getChildren().indexOf(player, true);
|
||||||
if (index < playerTurn) {
|
if (index < playerTurn) {
|
||||||
|
@ -101,7 +100,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.startPlaying();
|
actualPlayer.setPlaying(true);
|
||||||
} else {
|
} else {
|
||||||
players.removeActor(player);
|
players.removeActor(player);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue