Search in sources :

Example 1 with SlowTimeEffect

use of com.almasb.fxgl.dsl.effects.SlowTimeEffect in project FXGL by AlmasB.

the class BBoxSample method initInput.

@Override
protected void initInput() {
    getInput().addAction(new UserAction("Slow Time") {

        @Override
        protected void onActionBegin() {
            player.getComponent(EffectComponent.class).startEffect(new SlowTimeEffect(0.2, Duration.seconds(3)));
        }
    }, KeyCode.F);
    getInput().addAction(new UserAction("Change view 1") {

        @Override
        protected void onActionBegin() {
        // byType(Type.NPC).get(0).getComponent(EffectComponent.class).startEffect(new FlashEffect(Color.RED, Duration.seconds(0.75)));
        // player.setView(texture("bird.png").toAnimatedTexture(2, Duration.seconds(0.33)).play());
        }
    }, KeyCode.G);
    onKey(KeyCode.Q, () -> {
        scaleX += 0.1;
        player.setScaleX(scaleX);
    });
    onKey(KeyCode.E, () -> {
        scaleY += 0.1;
        player.setScaleY(scaleY);
    });
    onKey(KeyCode.Z, () -> {
        scaleX -= 0.1;
        player.setScaleX(scaleX);
    });
    onKey(KeyCode.C, () -> {
        scaleY -= 0.1;
        player.setScaleY(scaleY);
    });
    onKey(KeyCode.R, () -> {
        angle -= 5;
        player.setRotation(angle);
    });
    onKey(KeyCode.T, () -> {
        angle += 5;
        player.setRotation(angle);
    });
}
Also used : UserAction(com.almasb.fxgl.input.UserAction) SlowTimeEffect(com.almasb.fxgl.dsl.effects.SlowTimeEffect)

Aggregations

SlowTimeEffect (com.almasb.fxgl.dsl.effects.SlowTimeEffect)1 UserAction (com.almasb.fxgl.input.UserAction)1