use of com.b3dgs.lionengine.game.feature.rasterable.SetupSurfaceRastered in project lionengine by b3dgs.
the class SceneRasterable method add.
private void add(SetupSurfaceRastered setup, int offsetX) {
final SpriteAnimated surface = Drawable.loadSpriteAnimated(setup.getSurface(), 4, 4);
final Featurable featurable = new FeaturableModel(services, setup);
featurable.addFeature(new MirrorableModel(services, setup));
featurable.addFeature(new AnimatableModel(services, setup, surface));
final Transformable transformable = featurable.addFeatureAndGet(new TransformableModel(services, setup));
final Rasterable rasterable = new RasterableModel(services, setup);
rasterable.setOrigin(Origin.MIDDLE);
rasterable.setFrameOffsets(1, 2);
featurable.addFeature(rasterable);
featurable.addFeature(new RefreshableModel(extrp -> {
transformable.setLocationY(UtilMath.sin(count) * 240);
surface.setLocation(camera, transformable);
rasterable.update(extrp);
surface.update(extrp);
}));
featurable.addFeature(new DisplayableModel(g -> rasterable.render(g)));
transformable.setLocationX(120 + offsetX);
handler.add(featurable);
}
use of com.b3dgs.lionengine.game.feature.rasterable.SetupSurfaceRastered in project lionengine by b3dgs.
the class SceneRasterable method load.
@Override
public void load() {
add(new SetupSurfaceRastered(Medias.create("Object.xml"), Medias.create("tiles.png")), 0);
add(new SetupSurfaceRastered(Medias.create("Object2.xml")), 64);
add(new SetupSurfaceRastered(Medias.create("Object3.xml")), 128);
camera.setView(0, 0, getWidth(), getHeight(), getHeight());
tick.start();
}
Aggregations