Example usage for com.badlogic.gdx.graphics Color RED

List of usage examples for com.badlogic.gdx.graphics Color RED

Introduction

In this page you can find the example usage for com.badlogic.gdx.graphics Color RED.

Prototype

Color RED

To view the source code for com.badlogic.gdx.graphics Color RED.

Click Source Link

Usage

From source file:game.objects.Bullet.java

@Override
public void draw(SpriteBatch batch) {
    Color c = batch.getColor();//  w  w  w.jav  a  2  s.  co  m
    if (red)
        batch.setColor(Color.RED);
    super.draw(batch);
    if (red)
        batch.setColor(c);

}

From source file:GameObjects.Interface.java

private void addFPS() {
    Label.LabelStyle labelS = new Label.LabelStyle();
    labelS.font = new BitmapFont();
    labelS.fontColor = Color.RED;
    fpsText = new Label("", labelS);
    fpsText.setAlignment(Align.center);/*from   w w w  . j  av a  2s. c  om*/
    fpsText.setFontScale(1);
    fpsText.setSize(guiStage.getWidth() * 9 / 5, guiStage.getHeight() / 5);
    fpsText.setPosition(0, guiStage.getHeight() * 2 / 5);
    fpsText.setText("FPS: " + 0);
    guiStage.addActor(fpsText);
}

From source file:gui.entity.player.Player.java

protected void collisionTest() {
    // Collide bottom
    ThinGridCoordinates point = this.getCollisionPosDownLeft();
    Player.DrawDebugLine(point, point, 5, Color.RED, camera.combined);
    ThinGridCoordinates point2 = this.getCollisionPosDownRight();
    Player.DrawDebugLine(point2, point2, 5, Color.RED, camera.combined);

    // Collide Top
    ThinGridCoordinates point3 = this.getCollisionPosTopHalfLeft();
    Player.DrawDebugLine(point3, point3, 5, Color.RED, camera.combined);
    ThinGridCoordinates point4 = this.getCollisionPosTopHalfRight();
    Player.DrawDebugLine(point4, point4, 5, Color.RED, camera.combined);

    // Collide left
    ThinGridCoordinates point5 = this.getCollisionPosMiddleLeft();
    Player.DrawDebugLine(point5, point5, 5, Color.RED, camera.combined);
    // Collide left 2
    ThinGridCoordinates point9 = this.getCollisionPosMiddleLeft2();
    Player.DrawDebugLine(point9, point9, 5, Color.RED, camera.combined);

    // Collide right
    ThinGridCoordinates point6 = this.getCollisionPosMiddleRight();
    Player.DrawDebugLine(point6, point6, 5, Color.RED, camera.combined);
    // Collide right 2
    ThinGridCoordinates point8 = this.getCollisionPosMiddleRight2();
    Player.DrawDebugLine(point8, point8, 5, Color.RED, camera.combined);

    // Place item location
    ThinGridCoordinates point7 = this.getPlaceItemLocation();
    Player.DrawDebugLine(point7, point7, 5, Color.GOLD, camera.combined);
}

From source file:gui.screen.WinnerScreen.java

public WinnerScreen(ArrayList<Integer> playerPositions, final Game game, final Client client,
        final Server server) {
    super(game, client, server);

    //Set input and viewpoint
    stage = new Stage(new StretchViewport(Constants.SCREENWIDTH, Constants.SCREENHEIGHT));
    inputHandler.setInputSource(stage);//from  w w  w.ja va  2  s.c om

    // Unhides the cursor
    Gdx.input.setCursorCatched(false);

    this.playerPositions = playerPositions;

    //Set background
    rootTable.background(new TextureRegionDrawable(new TextureRegion(TextureManager.hostBackground)));
    rootTable.setFillParent(true);
    stage.addActor(rootTable);

    //Initialise Font
    FreeTypeFontGenerator.FreeTypeFontParameter fontOptions = new FreeTypeFontGenerator.FreeTypeFontParameter();
    fontOptions.size = 11;
    BitmapFont font = TextureManager.menuFont.generateFont(fontOptions);

    /**------------------------LABEL STYLE------------------------**/
    Label.LabelStyle labelStyle = new Label.LabelStyle();
    fontOptions.size = 60;
    labelStyle.font = TextureManager.menuFont.generateFont(fontOptions);
    labelStyle.fontColor = Color.GOLD;

    /**------------------------PLAYER DISPLAY WIDGET------------------------**/
    //Table options
    Table table = new Table();
    table.setFillParent(true);

    //P1 spawn field
    p1Field = new Container();
    p1Field.background(
            new TextureRegionDrawable((TextureRegion) TextureManager.p1WalkingDownAnim.getKeyFrame(0)));
    table.add(p1Field).width(64).height(64);

    //P2 spawn field
    p2Field = new Container();
    p2Field.setVisible(false);
    p2Field.background(
            new TextureRegionDrawable((TextureRegion) TextureManager.p2WalkingDownAnim.getKeyFrame(0)));
    table.add(p2Field).width(64).height(64).padLeft(96);

    //P3 spawn field
    p3Field = new Container();
    p3Field.setVisible(false);
    p3Field.background(
            new TextureRegionDrawable((TextureRegion) TextureManager.p3WalkingDownAnim.getKeyFrame(0)));
    table.add(p3Field).width(64).height(64).padLeft(96);

    //P4 spawn field
    p4Field = new Container();
    p4Field.setVisible(false);
    p4Field.background(
            new TextureRegionDrawable((TextureRegion) TextureManager.p4WalkingDownAnim.getKeyFrame(0)));
    table.add(p4Field).width(64).height(64).padLeft(96);

    //Stage & group options
    joinedPlayerGroup.addActor(table);
    joinedPlayerGroup.setPosition(443, 150);
    stage.addActor(joinedPlayerGroup);

    /**------------------------PLAYER HIGHLIGHT WIDGET------------------------**/
    //Table options
    Table table2 = new Table();
    table2.setFillParent(true);

    //P1 spawn field
    p1FieldHighlight = new Container();
    p1FieldHighlight.setVisible(false);
    p1FieldHighlight.background(new TextureRegionDrawable(new TextureRegion(TextureManager.playerMarker)));
    table2.add(p1FieldHighlight).width(80).height(77);

    //P2 spawn field
    p2FieldHighlight = new Container();
    p2FieldHighlight.setVisible(false);
    p2FieldHighlight.background(new TextureRegionDrawable(new TextureRegion(TextureManager.playerMarker)));
    table2.add(p2FieldHighlight).width(80).height(77).padLeft(80);

    //P3 spawn field
    p3FieldHighlight = new Container();
    p3FieldHighlight.setVisible(false);
    p3FieldHighlight.background(new TextureRegionDrawable(new TextureRegion(TextureManager.playerMarker)));
    table2.add(p3FieldHighlight).width(80).height(77).padLeft(80);

    //P4 spawn field
    p4FieldHighlight = new Container();
    p4FieldHighlight.setVisible(false);
    p4FieldHighlight.background(new TextureRegionDrawable(new TextureRegion(TextureManager.playerMarker)));
    table2.add(p4FieldHighlight).width(80).height(77).padLeft(80);

    //Stage & group options
    playerhighlightWidget.addActor(table2);
    playerhighlightWidget.setPosition(442, 152);
    stage.addActor(playerhighlightWidget);

    /**------------------------LABELS------------------------**/

    // Titel
    titel = new Label("", labelStyle);
    titel.setAlignment(Align.center);
    titel.setPosition((Constants.SCREENWIDTH - titel.getWidth()) / 2 + 50, 385);
    stage.addActor(titel);

    // If you are the winner
    if (Constants.PLAYERID == playerPositions.get(playerPositions.size() - 1)) {
        titel.setText("YOU WON!");
        isWinner = true;
    } else {
        isWinner = false;
        titel.setText("YOU LOOSE!");
        titel.setColor(Color.RED);
    }

    if (-1 == playerPositions.get(playerPositions.size() - 1)) {
        titel.setText("DRAW!");
        titel.setColor(Color.DARK_GRAY);
        isWinner = false;
    }

    Table positionTable = new Table();
    positionTable.setFillParent(true);

    p1Position = new Label("", labelStyle);
    p1Position.setAlignment(Align.center);

    p2Position = new Label("", labelStyle);
    p2Position.setAlignment(Align.center);

    p3Position = new Label("", labelStyle);
    p3Position.setAlignment(Align.center);

    p4Position = new Label("", labelStyle);
    p4Position.setAlignment(Align.center);

    positionTable.add(p1Position).width(64).height(64);
    positionTable.add(p2Position).width(64).height(64).padLeft(96);
    positionTable.add(p3Position).width(64).height(64).padLeft(96);
    positionTable.add(p4Position).width(64).height(64).padLeft(96);

    positionPlayerWidget.addActor(positionTable);
    positionPlayerWidget.setPosition(443, 230);
    stage.addActor(positionPlayerWidget);

    /**------------------------MUSIC------------------------**/

    if (isWinner == false) {
        AudioManager.setCurrentMusic(AudioManager.getLooserMusic());
        AudioManager.getCurrentMusic().setLooping(true);
        AudioManager.getCurrentMusic().play();
        AudioManager.getCurrentMusic().setVolume(AudioManager.getMusicVolume() * 4);
    } else {
        AudioManager.setCurrentMusic(AudioManager.getWinnerMusic());
        AudioManager.getCurrentMusic().setLooping(true);
        AudioManager.getCurrentMusic().play();
        AudioManager.getCurrentMusic().setVolume(AudioManager.getMusicVolume() * 6);
    }

    /**------------------------BUTTONS------------------------**/
    TextButton.TextButtonStyle textButtonStyleBack = new TextButton.TextButtonStyle();
    textButtonStyleBack.font = font;
    textButtonStyleBack.up = backSkin.getDrawable("button_up");
    textButtonStyleBack.down = backSkin.getDrawable("button_down");
    textButtonStyleBack.over = backSkin.getDrawable("button_checked");

    // Back button
    backButton = new TextButton("", textButtonStyleBack);
    backButton.setPosition(0, Constants.SCREENHEIGHT - backButton.getHeight() + 7);
    stage.addActor(backButton);

    renderPlayers();

    //Add click listener --> Back button
    backButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeListener.ChangeEvent event, Actor actor) {
            //Add click musik
            AudioManager.playClickSound();

            // Wait till sound is done
            try {
                Thread.sleep(100);

            } catch (InterruptedException ex) {

            }

            if (isWinner) {
                AudioManager.getCurrentMusic().stop();
            } else {
                AudioManager.getCurrentMusic().stop();
            }

            server.stopServer();
            game.setScreen(new MenuScreen(game, client, server));
        }
    });
}

From source file:im.ligas.worms.screen.GameOverScreen.java

License:Open Source License

@Override
public void render(float delta) {
    camera.update();//from w  ww  . j  a va 2s .c o  m
    game.batch.setProjectionMatrix(camera.combined);

    game.batch.begin();
    game.mediumFont.setColor(Color.PURPLE);
    game.bigFont.setColor(Color.RED);
    game.bigFont.draw(game.batch, "GAME OVER", CENTER.x - 200, CENTER.y + 100);
    if (sprite != null) {
        game.mediumFont.draw(game.batch, "THE WINNER IS", CENTER.x - 170, CENTER.y);
        sprite.draw(game.batch);
    }

    game.batch.end();
}

From source file:im.ligas.worms.worm.WormFactory.java

License:Open Source License

public static WormWithAbility getTurboWorm(Vector2 start, int keyLeft, int keyRight, int keyExecute) {
    return new TurboWormImpl(start, Color.RED, (byte) 0, keyLeft, keyRight, keyExecute);
}

From source file:io.piotrjastrzebski.sfg.screen.SkinSelectScreen.java

License:Open Source License

private void refreshUI() {
    contTable.clearChildren();//from  w  ww  . jav  a 2 s.  co  m
    skinLabels.clear();
    skinTables.clear();

    PlayerStats.Skin current = playerStats.getPlayerSkin();

    final Array<PlayerStats.Skin> skins = playerStats.getSkins();
    int size = skins.size;
    // dont show last skin on non android
    if (!(Gdx.app.getType() == Application.ApplicationType.Android)) {
        size -= 1;
    }
    for (int i = 0; i < size; i++) {
        final PlayerStats.Skin skin = skins.get(i);
        final Table skinTable = createSkinItem(skin);
        final Label skinLabel = skinLabels.get(i);
        if (current.id == skin.id)
            skinTable.setBackground(select);
        skinTables.add(skinTable);
        skinTable.addListener(new ClickListener() {
            @Override
            public void clicked(InputEvent event, float x, float y) {
                if (skin.isUnlocked()) {
                    if (skinTable.getBackground() == empty) {
                        clearSelect();
                        skinTable.setBackground(select);
                        playerStats.setPlayerSkin(skin);
                    } else {
                        skinTable.setBackground(empty);
                        playerStats.setDefaultPlayerSkin();
                        selectDefault();
                    }
                    skinLabel.clearActions();
                    skinLabel.addAction(
                            Actions.sequence(Actions.color(assets.getSkin().getColor("toxic"), 0.33f),
                                    Actions.color(Color.WHITE, 0.33f)));
                    contTable.invalidateHierarchy();
                } else {
                    if (skin.id == PlayerStats.SKIN_RUBY) {
                        playerStats.buyPremium();
                    } else {
                        skinLabel.clearActions();
                        skinLabel.addAction(Actions.sequence(Actions.color(Color.RED, 0.25f),
                                Actions.color(Color.WHITE, 0.25f)));
                    }
                }
                playButtonPressSound();
            }
        });
        contTable.add(skinTable).expandX().fillX();
        contTable.row();
    }
}

From source file:jordanlw.gdxGame.Zombie.java

License:Open Source License

public void draw(SpriteBatch batch, float stateTime) {
    if (this.secondsDamaged > 0f) {
        batch.setColor(Color.RED);
    } else {/* ww w .  ja v a2  s.  c  o m*/
        batch.setColor(Color.WHITE);
    }
    if (this.health <= 0) {
        return;
    }
    batch.draw(anim.getKeyFrame(stateTime),
            this.position.x - (anim.getKeyFrame(stateTime).getRegionWidth() / 2),
            this.position.y - (anim.getKeyFrame(stateTime).getRegionHeight() / 2),
            anim.getKeyFrame(stateTime).getRegionWidth() / 2, anim.getKeyFrame(stateTime).getRegionHeight() / 2,
            anim.getKeyFrame(stateTime).getRegionWidth(), anim.getKeyFrame(stateTime).getRegionHeight(), 1, 1,
            this.rotation + 90);
    /*
    if (this.secondsDamaged > 0) {
    batch.draw(flame.getKeyFrame(stateTime), position.x - (anim.getKeyFrame(0).getRegionWidth()/2), position.y - (anim.getKeyFrame(0).getRegionHeight()/2));
    }
    */
}

From source file:ludowars.view.EntityRepresentation.java

public void renderBoundingBox(ShapeRenderer sr) {
    EntityData data = entity.getData();//from w  w  w .  java  2 s .  c om
    sr.begin(ShapeRenderer.ShapeType.Line);
    sr.setColor(Color.RED);
    sr.rect(data.getBounds().x, data.getBounds().y, data.getBounds().width, data.getBounds().height);
    sr.end();
}

From source file:ludowars.view.PlayerRepresentation.java

public void drawHealth(ShapeRenderer s, Vector3 sv, CharacterData data) {
    float healthWidth = data.getHealth() / data.maxHealth * 40;

    s.begin(ShapeRenderer.ShapeType.Filled);
    s.setColor(Color.valueOf("FFAA00"));
    s.rect(sv.x - 12 - 4, sv.y + 36, 40, 8);
    s.end();//w  w  w  . j av  a 2 s . c  om

    if (data.getHealth() > 0) {
        s.begin(ShapeRenderer.ShapeType.Filled);
        s.setColor(Color.RED);
        s.rect(sv.x - 12 + 2 - 4, sv.y + 36 + 2, healthWidth - 4, 8 - 4);
        s.end();
    }
}