Search in sources :

Example 1 with WobbleEffect

use of com.almasb.fxgl.entity.effect.WobbleEffect in project FXGL by AlmasB.

the class WobbleSample method initInput.

@Override
protected void initInput() {
    DSLKt.onKeyDown(KeyCode.F, "asd", () -> {
        player.getControl(EffectControl.class).startEffect(new WobbleEffect(Duration.seconds(3), 3, 7, Orientation.VERTICAL));
    });
    DSLKt.onKeyDown(KeyCode.G, "asd2", () -> {
        player.getControl(EffectControl.class).startEffect(new WobbleEffect(Duration.seconds(3), 2, 4, Orientation.HORIZONTAL));
    });
}
Also used : WobbleEffect(com.almasb.fxgl.entity.effect.WobbleEffect) EffectControl(com.almasb.fxgl.entity.control.EffectControl)

Example 2 with WobbleEffect

use of com.almasb.fxgl.entity.effect.WobbleEffect in project FXGL by AlmasB.

the class MarioApp method initInput.

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

        @Override
        protected void onAction() {
            player.getControl(PlayerControl.class).left();
        }
    }, KeyCode.A);
    getInput().addAction(new UserAction("Right") {

        @Override
        protected void onAction() {
            player.getControl(PlayerControl.class).right();
        }
    }, KeyCode.D);
    getInput().addAction(new UserAction("Jump") {

        @Override
        protected void onAction() {
            player.getControl(PlayerControl.class).jump();
        }
    }, KeyCode.W);
    DSLKt.onKeyDown(KeyCode.F, "asd", () -> {
        player.getControl(EffectControl.class).startEffect(new WobbleEffect(Duration.seconds(3), 3, 7, Orientation.VERTICAL));
    });
    DSLKt.onKeyDown(KeyCode.G, "asd2", () -> {
        player.getControl(EffectControl.class).startEffect(new WobbleEffect(Duration.seconds(3), 2, 4, Orientation.HORIZONTAL));
    });
}
Also used : UserAction(com.almasb.fxgl.input.UserAction) WobbleEffect(com.almasb.fxgl.entity.effect.WobbleEffect) EffectControl(com.almasb.fxgl.entity.control.EffectControl)

Aggregations

EffectControl (com.almasb.fxgl.entity.control.EffectControl)2 WobbleEffect (com.almasb.fxgl.entity.effect.WobbleEffect)2 UserAction (com.almasb.fxgl.input.UserAction)1