color fix
This commit is contained in:
parent
9492b79f38
commit
2406453507
|
@ -11,6 +11,7 @@ public class SagittariusGame extends Game {
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
public static float G = 100;
|
public static float G = 100;
|
||||||
|
public static int numberPlayers = 3;
|
||||||
public static boolean debugMode = false;
|
public static boolean debugMode = false;
|
||||||
public static Music music;
|
public static Music music;
|
||||||
public static boolean disableMusic = true;
|
public static boolean disableMusic = true;
|
||||||
|
|
|
@ -86,6 +86,7 @@ public class GameScreen extends BaseScreen implements InputProcessor {
|
||||||
attractors = new Group();
|
attractors = new Group();
|
||||||
|
|
||||||
for (int i = 0; i < numberPlanets; i++) {
|
for (int i = 0; i < numberPlanets; i++) {
|
||||||
|
// Position of the new planet
|
||||||
Vector2 position;
|
Vector2 position;
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
position = new Vector2(0, 0);
|
position = new Vector2(0, 0);
|
||||||
|
@ -111,19 +112,24 @@ public class GameScreen extends BaseScreen implements InputProcessor {
|
||||||
}
|
}
|
||||||
} while (shortestDistance < minDistance);
|
} while (shortestDistance < minDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// other attributs
|
||||||
int mass = minMass + MathUtils.random(maxMass - minMass);
|
int mass = minMass + MathUtils.random(maxMass - minMass);
|
||||||
int radius = minRadius + MathUtils.random(maxRadius - minRadius);
|
int radius = minRadius + MathUtils.random(maxRadius - minRadius);
|
||||||
Color color = new Color((int)(Math.random() * 0x1000000));
|
Color color = new Color((float) Math.random(), (float) Math.random(), (float) Math.random(), 1);
|
||||||
|
|
||||||
|
// create the planet
|
||||||
Planet planet = new Planet(position, mass, radius, color);
|
Planet planet = new Planet(position, mass, radius, color);
|
||||||
attractors.addActor(planet);
|
attractors.addActor(planet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// create a moon
|
||||||
Moon moon = new Moon(
|
Moon moon = new Moon(
|
||||||
(Planet) attractors.getChild( MathUtils.random(numberPlanets-1)),
|
(Planet) attractors.getChild( MathUtils.random(numberPlanets-1)),
|
||||||
minMass / 2 + MathUtils.random(maxMass - minMass) / 2,
|
minMass / 2 + MathUtils.random(maxMass - minMass) / 2,
|
||||||
minRadius / 2 + MathUtils.random(maxRadius - minRadius) / 2,
|
minRadius / 2 + MathUtils.random(maxRadius - minRadius) / 2,
|
||||||
minDistance / 2,
|
minDistance / 2,
|
||||||
new Color((int)(Math.random() * 0x1000000))
|
new Color((float) Math.random(), (float) Math.random(), (float) Math.random(), 1)
|
||||||
);
|
);
|
||||||
attractors.addActor(moon);
|
attractors.addActor(moon);
|
||||||
|
|
||||||
|
@ -132,14 +138,10 @@ public class GameScreen extends BaseScreen implements InputProcessor {
|
||||||
// players
|
// players
|
||||||
players = new Group();
|
players = new Group();
|
||||||
|
|
||||||
Player player1 = new Player((Planet) attractors.getChild(0), Color.RED);
|
for (int i = 0; i < SagittariusGame.numberPlayers; i++) {
|
||||||
players.addActor(player1);
|
Player player = new Player((Planet) attractors.getChild(i), new Color((float) Math.random(), (float) Math.random(), (float) Math.random(), 1));
|
||||||
|
players.addActor(player);
|
||||||
Player player2 = new Player((Planet) attractors.getChild(1), Color.WHITE);
|
}
|
||||||
players.addActor(player2);
|
|
||||||
|
|
||||||
Player player3 = new Player((Planet) attractors.getChild(2), Color.YELLOW);
|
|
||||||
players.addActor(player3);
|
|
||||||
|
|
||||||
mainStage.addActor(players);
|
mainStage.addActor(players);
|
||||||
|
|
||||||
|
@ -155,8 +157,8 @@ public class GameScreen extends BaseScreen implements InputProcessor {
|
||||||
|
|
||||||
// game turns
|
// game turns
|
||||||
playerIndex = 0;
|
playerIndex = 0;
|
||||||
player1.setActive(true);
|
((Player) players.getChild(0)).setActive(true);
|
||||||
playerCurrent = player1;
|
playerCurrent = (Player) players.getChild(0);
|
||||||
|
|
||||||
// camera stuff
|
// camera stuff
|
||||||
mainCameraPosition = mainStage.getCamera().position;
|
mainCameraPosition = mainStage.getCamera().position;
|
||||||
|
|
Loading…
Reference in a new issue