/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.game.runner.base;

import org.andengine.entity.scene.background.AutoParallaxBackground;
import org.andengine.entity.scene.background.ParallaxBackground;
import org.andengine.entity.sprite.Sprite;

/**
 *
 * @author Karl
 */
public abstract class BaseMenuScene extends BaseScene{
    private AutoParallaxBackground autoParallaxBackground;
    private Sprite parallaxLayer1;
    private Sprite parallaxLayer2;
    private Sprite parallaxLayer3;
    private Sprite parallaxLayer4;
    
    @Override
    public void createScene() {
        this.createBackground();
    }
    
    private void createBackground(){
        this.autoParallaxBackground = new AutoParallaxBackground(0, 0, 0, 5);
        this.setBackground(this.autoParallaxBackground);
        this.parallaxLayer1 = new Sprite(0, 0, this.resourcesManager.mainMenuParallaxLayer1, this.vbom);
        this.parallaxLayer2 = new Sprite(0, 0, this.resourcesManager.mainMenuParallaxLayer2, this.vbom);
        this.parallaxLayer3 = new Sprite(0, 0, this.resourcesManager.mainMenuParallaxLayer3, this.vbom);
        this.parallaxLayer4 = new Sprite(0, 0, this.resourcesManager.mainMenuParallaxLayer4, this.vbom);
        this.parallaxLayer1.setOffsetCenter(-1.5f, -1.5f);
        this.parallaxLayer2.setOffsetCenter(-1.5f, -1.5f);
        this.parallaxLayer3.setOffsetCenter(-1.5f, -1.5f);
        this.parallaxLayer4.setOffsetCenter(-1.5f, -1.5f);
        this.parallaxLayer1.setScale(4f);
        this.parallaxLayer2.setScale(4f);
        this.parallaxLayer3.setScale(4f);
        this.parallaxLayer4.setScale(4f);
        this.autoParallaxBackground.attachParallaxEntity(new ParallaxBackground.ParallaxEntity(-10.0f, this.parallaxLayer1));
        this.autoParallaxBackground.attachParallaxEntity(new ParallaxBackground.ParallaxEntity(-15.0f, this.parallaxLayer2));
        this.autoParallaxBackground.attachParallaxEntity(new ParallaxBackground.ParallaxEntity(-20.0f, this.parallaxLayer3));
        this.autoParallaxBackground.attachParallaxEntity(new ParallaxBackground.ParallaxEntity(-25.0f, this.parallaxLayer4));
    }

    @Override
    public void onPause() {
        this.audioManager.pause();
    }

    @Override
    public void onResume() {
        this.audioManager.resume();
    }
    
    @Override
    public void disposeScene() {
        this.parallaxLayer1.detachSelf();
        this.parallaxLayer1.dispose();
        this.parallaxLayer2.detachSelf();
        this.parallaxLayer2.dispose();
        this.parallaxLayer3.detachSelf();
        this.parallaxLayer3.dispose();
        this.parallaxLayer4.detachSelf();
        this.parallaxLayer4.dispose();
    }
}

@@ -583,16 +583,50 @@
 Layer4;%0A
+    private float parallaxFactor;%0A
     %0A   
@@ -708,24 +708,138 @@
 %0A    %7D%0A    %0A
+    public void setParallaxFactor(float parallaxFactor)%7B%0A        this.parallaxFactor = parallaxFactor;%0A    %7D%0A    %0A
     private 
@@ -863,16 +863,50 @@
 ound()%7B%0A
+        this.parallaxFactor = 1f;%0A
         
@@ -973,16 +973,198 @@
 0, 0, 5)
+%7B%0A            @Override%0A            public void onUpdate(final float pSecondsElapsed) %7B%0A%09%09super.onUpdate(pSecondsElapsed * BaseMenuScene.this.parallaxFactor);%0A            %7D%0A        %7D
 ;%0A      

Prepare parallax factor in menus