TGMG wrote:
But anyway, do cameras actually do anything in the block example? I commented the code out and it didn't seem to change the game atall.
Layer size = screen size in that game, so it has no effect to move it around.
TGMG wrote:
Is it possible to have more than one camera view on screen for example a split screen multiplayer game where each View shows a part of the scene?
I'll get back to you on this later. It's some surface tweaking to make this work.
Nero wrote:
Is there any chance to use the parallax feature with my map and a background layer and use the Camera feature to focus my Slick-made character?
This is standard usage. All you do is...
1) Create ParallaxLayer
2) Add an ImageLayer to it (this is your background image)
3) Set up Scene and add the ParallaxLayer to it.
4) Add a Camera to the Scene.
5) Every update, center the camera on the character.
Code below...
Code:
scene = new Scene(game);
ImageLayer back = new ImageLayer(background);
ParallaxLayer parallax = new ParallaxLayer(2048, 1024);
parallax.addBackgroundLayer(back);
scene.setLayer(parallax);
scene.addGroup(players);
scene.addGroup(tiles);
scene.addGroup(misc);
camera = new Camera();
scene.setCamera(camera);
Code:
public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException
{
camera.centerCamera(CHARACTER_HERE);
scene.update(delta);
}