I'm using AndEngine GLES1. In my game, I use AnalogOnScreenControl to move a sprite and when it moves vertically, the background image also moves vertically. I want to do something like this: that is in this link. I know that AutoParallax Background or BackgroundParallaxScrolling may be used. But how do I use it in my game?


Have you looked at the AutoParallax example code in AndEngine? It creates the parallax background layers iike this:

final Scene scene = new Scene();
final AutoParallaxBackground autoParallaxBackground = new AutoParallaxBackground(0, 0, 0, 5);
final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
autoParallaxBackground.attachParallaxEntity(new ParallaxEntity(0.0f, new Sprite(0, CAMERA_HEIGHT - this.mParallaxLayerBack.getHeight(), this.mParallaxLayerBack, vertexBufferObjectManager)));
autoParallaxBackground.attachParallaxEntity(new ParallaxEntity(-5.0f, new Sprite(0, 80, this.mParallaxLayerMid, vertexBufferObjectManager)));
autoParallaxBackground.attachParallaxEntity(new ParallaxEntity(-10.0f, new Sprite(0, CAMERA_HEIGHT - this.mParallaxLayerFront.getHeight(), this.mParallaxLayerFront, vertexBufferObjectManager)));

You can read the rest of the code here.

  • \$\begingroup\$ Sorry for my outside question. I want to ask that is it possible to create this type truck in andengine? Because whenever I create any vehicle it stretches out from the joint. I don't know why this happen. \$\endgroup\$
    – Siddharth
    Mar 5 '13 at 19:10
  • \$\begingroup\$ Ask it in a separate question, or no one will find it! \$\endgroup\$ Mar 5 '13 at 19:48
  • \$\begingroup\$ I Tried this code but VertexBufferObjectManager is not Working. \$\endgroup\$
    – Bin
    Mar 6 '13 at 9:20
  • \$\begingroup\$ Can you post the stack trace? Can you run the built in examples, in general? \$\endgroup\$ Mar 6 '13 at 16:14
  • \$\begingroup\$ I have red line on VertexBufferObjectManager and i solve my problem with tileCollision example, link of this example is here:link Thanks. \$\endgroup\$
    – Bin
    Mar 7 '13 at 5:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .