Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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)));
scene.setBackground(autoParallaxBackground);

You can read the rest of the code here.

share|improve this answer
    
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. –  Siddharth Mar 5 '13 at 19:10
    
Ask it in a separate question, or no one will find it! –  Cameron Fredman Mar 5 '13 at 19:48
    
I Tried this code but VertexBufferObjectManager is not Working. –  Bin Mar 6 '13 at 9:20
    
Can you post the stack trace? Can you run the built in examples, in general? –  Cameron Fredman Mar 6 '13 at 16:14
    
I have red line on VertexBufferObjectManager and i solve my problem with tileCollision example, link of this example is here:link Thanks. –  Bin Mar 7 '13 at 5:36

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.