Question

Please any one assist me for implement parallax screen in super jumper game because I unnable to implement that. I have seen ParallaxTest.java of your code but I can't Implement it. I same code in one class(ParallaxTest.java) and write only parallaxCamera class and in WorldRenderer I implement as but produce null pointer exception.

code:

  public void renderBackground()
   {
  // background layer, no parallax, centered around origin
 bath1.setProjectionMatrix(ParallaxCam.calculateParallaxMatrix(1, 1));

bath1.disableBlending();
bath1.begin();
bath1.draw(Assets.mainbackgroundRegion,ParallaxCam.position.x - FRUSTUM_WIDTH / 2,         ParallaxCam.position.y - FRUSTUM_HEIGHT/2, FRUSTUM_WIDTH, FRUSTUM_HEIGHT);
bath1.end();

in renderer---

if(ParallaxCam.position.y<FRUSTUM_HEIGHT)
{
ParallaxCam.position.y=FRUSTUM_HEIGHT;
//updateCamera = true;
}

And in constructr of WorldRendere--

this.ParallaxCam = new MyParallaxTest().new ParallaxCamera(FRUSTUM_WIDTH, FRUSTUM_HEIGHT);
 mcontroller = new OrthoCamController(this.ParallaxCam);
Gdx.input.setInputProcessor(mcontroller);
}
Was it helpful?

Solution

for this see this URL complete implementation is here http://www.badlogicgames.com/forum/viewtopic.php?f=17&t=1795

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top