Search in sources :

Example 1 with ParallaxTexture

use of com.almasb.fxgl.entity.view.ParallaxTexture in project FXGL by AlmasB.

the class ScifiSample method initGame.

@Override
protected void initGame() {
    // assets from https://raventale.itch.io/parallax-background
    getGameScene().addGameView(new ParallaxBackgroundView(Arrays.asList(new ParallaxTexture(getAssetLoader().loadTexture("bg_10.png", getWidth(), getHeight()), 1.0), new ParallaxTexture(getAssetLoader().loadTexture("bg_9.png", getWidth(), getHeight()), 0.05), new ParallaxTexture(getAssetLoader().loadTexture("bg_8.png", getWidth(), getHeight()), 0.1), new ParallaxTexture(getAssetLoader().loadTexture("bg_7.png", getWidth(), getHeight()), 0.3), new ParallaxTexture(getAssetLoader().loadTexture("bg_6.png", getWidth(), getHeight()), 0.45), // new ParallaxTexture(getAssetLoader().loadTexture("bg_4.png", getWidth(), getHeight()), 0.6),
    new ParallaxTexture(getAssetLoader().loadTexture("bg_3.png", getWidth(), getHeight()), 0.5), new ParallaxTexture(getAssetLoader().loadTexture("bg_2.png", getWidth(), getHeight()), 0.7), new ParallaxTexture(getAssetLoader().loadTexture("bg_1.png", getWidth(), getHeight()), 0.8), new ParallaxTexture(getAssetLoader().loadTexture("bg_0.png", getWidth(), getHeight()), 0.9)), Orientation.HORIZONTAL));
    nextLevel();
// getGameplay().getAchievementManager()
// .getAchievementByName("Collector")
// .bind(getGameState().intProperty("coins"), 10);
// getMasterTimer().runOnceAfter(this::seerCutscene, Duration.seconds(7));
}
Also used : ParallaxBackgroundView(com.almasb.fxgl.entity.view.ParallaxBackgroundView) ParallaxTexture(com.almasb.fxgl.entity.view.ParallaxTexture)

Aggregations

ParallaxBackgroundView (com.almasb.fxgl.entity.view.ParallaxBackgroundView)1 ParallaxTexture (com.almasb.fxgl.entity.view.ParallaxTexture)1