Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I implemented ParallaxScrolling for my SideScroller project, everything is working but the tiled map (the most important part!). I've been trying out everything but it doesn't work (see the code below).

I'm using ParallaxCamera from GdxTests, it's working perfectly for the background layers.

I can't explain myself properly in english, so I recorded 2 videos:

Before parallaxScrolling

After parallaxScrolling

As you can see, now the platforms appear in the middle of the Y-axis.

I've got a Map class with 2 tiled maps, so I need two renderers too:

private TiledMapRenderer renderer1;
private TiledMapRenderer renderer2;

public void update(GameCamera camera) {
renderer1.setView(camera.calculateParallaxMatrix(1f, 0f), camera.position.x - camera.viewportWidth / 2, 
           **camera.position.y - camera.viewportHeight/2**, camera.viewportWidth, camera.viewportHeight);
renderer2.setView(camera.calculateParallaxMatrix(1f, 0f), camera.position.x - camera.viewportWidth / 2,
           **camera.position.y - camera.viewportHeight/2**, camera.viewportWidth, camera.viewportHeight);

In bold, the code I think I should change. I've tried changing parameters, even adding hardcoded values, etc, but one of two: 1. Nothing happens. 2. Platforms disappear.

Here is some aditional code. The render method:


    clear(0.5f, 0.7f, 1.0f, 1);

    batch.setProjectionMatrix(camera.calculateParallaxMatrix(0, 0));
    batch.draw(background, -(int)background.getRegionWidth()/2, -(int)background.getRegionHeight()/2);

    parallaxBackground.draw(batch, camera);
share|improve this question
Just to clarify the issue, after you implemented parallax scrolling, the platforms are now drawing too high up on the screen? I'm not sure why the y values should change at all when implementing scrolling on the x axis. Why not just set the y axis camera view to the same as it was before implementing parallax scrolling? – Byte56 Jul 2 '13 at 20:38
Hi. I did it, but it doesn't work. I recorded a video so you can see how I change values: – kirchhoff Jul 2 '13 at 22:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.