mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Merge branch 'master' of https://github.com/inf112-v20/Fiasko
This commit is contained in:
commit
4653002d0f
@ -0,0 +1,37 @@
|
||||
package inf112.fiasko.roborally.game_wrapper;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Skin;
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
|
||||
|
||||
/**
|
||||
* This class generates a simple text button using a default skin
|
||||
*/
|
||||
public class SimpleButton {
|
||||
private TextButton button;
|
||||
|
||||
/**
|
||||
* Instantiates a new simple button
|
||||
* @param text The text to display on the button
|
||||
* @param font The font to use to draw button text
|
||||
*/
|
||||
public SimpleButton(String text, BitmapFont font) {
|
||||
TextureAtlas buttonAtlas = new TextureAtlas(Gdx.files.internal("uiskin.atlas"));
|
||||
Skin skin = new Skin(buttonAtlas);
|
||||
TextButton.TextButtonStyle confirmCardsStyle = new TextButton.TextButtonStyle();
|
||||
confirmCardsStyle.font = font;
|
||||
confirmCardsStyle.up = skin.getDrawable("default-round");
|
||||
confirmCardsStyle.down = skin.getDrawable("default-round-down");
|
||||
this.button = new TextButton(text, confirmCardsStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the button generated
|
||||
* @return A button
|
||||
*/
|
||||
public TextButton getButton() {
|
||||
return this.button;
|
||||
}
|
||||
}
|
@ -106,6 +106,7 @@ public class RoboRallyGame implements IDrawableGame {
|
||||
robots.add(new Robot(RobotID.ROBOT_6, new Position(7, 7)));
|
||||
robots.add(new Robot(RobotID.ROBOT_7, new Position(6, 7)));
|
||||
robots.add(new Robot(RobotID.ROBOT_8, new Position(6, 8)));
|
||||
playerList = new ArrayList<>();
|
||||
playerList.add(new Player(RobotID.ROBOT_1, "Player1"));
|
||||
playerList.add(new Player(RobotID.ROBOT_2, "Player2"));
|
||||
playerList.add(new Player(RobotID.ROBOT_3, "Player3"));
|
||||
@ -177,6 +178,21 @@ public class RoboRallyGame implements IDrawableGame {
|
||||
makeMove(RobotID.ROBOT_7, Action.MOVE_1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs one phase as defined in the Robo Rally rulebook
|
||||
* @param phaseNumber The number of the phase to run
|
||||
* @throws InterruptedException If interrupted wile trying to sleep
|
||||
*/
|
||||
private void runPhase(int phaseNumber) throws InterruptedException {
|
||||
runProgramCards(phaseNumber);
|
||||
|
||||
moveAllConveyorBelts();
|
||||
rotateCogwheels();
|
||||
|
||||
fireAllLasers();
|
||||
checkAllFlags();
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes the given robot move according to to the action input.
|
||||
* @param robotID The ID of the robot to move.
|
||||
|
Loading…
x
Reference in New Issue
Block a user