Search in sources :

Example 1 with ComputerCombatGame

use of com.janfic.games.computercombat.ComputerCombatGame in project computercombat by janfic.

the class AndroidLauncher method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    initialize(new ComputerCombatGame(), config);
}
Also used : ComputerCombatGame(com.janfic.games.computercombat.ComputerCombatGame) AndroidApplicationConfiguration(com.badlogic.gdx.backends.android.AndroidApplicationConfiguration)

Example 2 with ComputerCombatGame

use of com.janfic.games.computercombat.ComputerCombatGame in project computercombat by janfic.

the class DesktopLauncher method main.

public static void main(String[] arg) {
    LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
    config.width = 1920 / 2;
    config.height = 1080 / 2;
    config.resizable = true;
    new LwjglApplication(new ComputerCombatGame(), config);
}
Also used : LwjglApplication(com.badlogic.gdx.backends.lwjgl.LwjglApplication) LwjglApplicationConfiguration(com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration) ComputerCombatGame(com.janfic.games.computercombat.ComputerCombatGame)

Example 3 with ComputerCombatGame

use of com.janfic.games.computercombat.ComputerCombatGame in project computercombat by janfic.

the class DrawAnimation method animate.

@Override
public List<List<Action>> animate(String currentPlayerUID, String playerUID, MatchScreen screen, float animationSpeed) {
    Table leftPanel = screen.getLeftPanel();
    Table rightPanel = screen.getRightPanel();
    Table panel;
    if (playerUID.equals(currentPlayerUID)) {
        panel = leftPanel;
    } else {
        panel = rightPanel;
    }
    List<List<Action>> animations = new ArrayList<>();
    ComputerCombatGame game = (ComputerCombatGame) Gdx.app.getApplicationListener();
    if (newSoftware.size() > 0) {
        List<Action> cardAnimation = new ArrayList<>();
        Table t = new Table();
        t.setFillParent(true);
        Card loadNewCard = SQLAPI.getSingleton().getCardById(newSoftware.get(0).getID(), newSoftware.get(0).getOwnerUID());
        loadNewCard.setMatchID(newSoftware.get(0).getMatchID());
        CollectionCard card = new CollectionCard(game, screen.getSkin(), loadNewCard, 1);
        card.setTouchable(Touchable.disabled);
        Stage stage = screen.getMainStage();
        stage.addActor(t);
        card.setVisible(false);
        card.setPosition(stage.getWidth() / 2, -300);
        t.add(card).expand().center();
        Action cardAction = Actions.sequence(Actions.moveBy(0, -400), Actions.visible(true), Actions.moveBy(0, 400, 1 * animationSpeed, Interpolation.fastSlow), Actions.delay(1 * animationSpeed), Actions.moveBy(0, -400, 1 * animationSpeed, Interpolation.slowFast));
        cardAction.setActor(card);
        cardAnimation.add(cardAction);
        animations.add(cardAnimation);
        List<SoftwareActor> softwareActors = screen.getSoftwareActors().get(currentPlayerUID);
        ComputerActor computerActor = screen.getComputerActors().get(currentPlayerUID);
        List<Action> softwareAnimation = new ArrayList<>();
        SoftwareActor softwareActor = new SoftwareActor(screen.getSkin(), !playerUID.equals(currentPlayerUID), loadNewCard, game);
        panel.clear();
        for (SoftwareActor s : softwareActors) {
            panel.add(s).row();
        }
        panel.add(softwareActor).row();
        panel.add(computerActor).expandY().growX().bottom();
        softwareActor.setVisible(false);
        softwareActors.add(softwareActor);
        Action softwareActorAction = Actions.sequence(Actions.moveBy(0, -400), Actions.visible(true), Actions.moveBy(0, 400, 1 * animationSpeed, Interpolation.fastSlow));
        softwareActorAction.setActor(softwareActor);
        softwareAnimation.add(softwareActorAction);
        animations.add(softwareAnimation);
    }
    return animations;
}
Also used : Action(com.badlogic.gdx.scenes.scene2d.Action) SoftwareActor(com.janfic.games.computercombat.actors.SoftwareActor) Table(com.badlogic.gdx.scenes.scene2d.ui.Table) ArrayList(java.util.ArrayList) CollectionCard(com.janfic.games.computercombat.actors.CollectionCard) ComputerCombatGame(com.janfic.games.computercombat.ComputerCombatGame) CollectionCard(com.janfic.games.computercombat.actors.CollectionCard) Card(com.janfic.games.computercombat.model.Card) ComputerActor(com.janfic.games.computercombat.actors.ComputerActor) Stage(com.badlogic.gdx.scenes.scene2d.Stage) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

ComputerCombatGame (com.janfic.games.computercombat.ComputerCombatGame)3 AndroidApplicationConfiguration (com.badlogic.gdx.backends.android.AndroidApplicationConfiguration)1 LwjglApplication (com.badlogic.gdx.backends.lwjgl.LwjglApplication)1 LwjglApplicationConfiguration (com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration)1 Action (com.badlogic.gdx.scenes.scene2d.Action)1 Stage (com.badlogic.gdx.scenes.scene2d.Stage)1 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)1 CollectionCard (com.janfic.games.computercombat.actors.CollectionCard)1 ComputerActor (com.janfic.games.computercombat.actors.ComputerActor)1 SoftwareActor (com.janfic.games.computercombat.actors.SoftwareActor)1 Card (com.janfic.games.computercombat.model.Card)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1