Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7609221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:07:13+00:00 2026-05-31T01:07:13+00:00

i am using AndEngine. I have a scene that i would like to reuse

  • 0

i am using AndEngine.

I have a scene that i would like to reuse for all of my levels.

The only thing that will change is the objects loaded on the scene through a method i created to load the level.

The problem i am facing is that at the end of the level the user gets the option to continue to the next level. I allow the user to load the next level with this method.

this.nextlevel = new Sprite(0,0,150,80,this.nextLevelRegion,this.getVertexBufferObjectManager()){
         public boolean onAreaTouched(final TouchEvent pSceneTouchEvent,
                final float pTouchAreaLocalX,
                final float pTouchAreaLoca) {

            GameScene.detachChildren();

            loadLevel(level);
            return true;
        }
};

The loadLevel(int level_number) takes a int as a parameter. I increase this variable by level++; after the current level is loaded.

The problem is when the sprite is clicked it keeps adding +1 to the level integer and trying to load the wrong level..

Anyone know a better way of doing this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T01:07:15+00:00Added an answer on May 31, 2026 at 1:07 am

    this is what i did in my game:
    i created a class that creates the game play scene, this class has a method that creates the scene and loads an XML level based on the number that it recieves when i call it.
    when i want to go to next level i get the current level number (lets say its x) and call the method with x+1 as an attribute for it.
    you should note that i depend in this method on recreating the scene all over again so you should reset every thing when you do that.
    this is the call for the method:

     Sprite Next=new Sprite(x-48/factor, y+30/factor, 96/factor, 60/factor,LoadAssets.WinMenuNextTextureRegion){
    @Override
    public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
    if(pSceneTouchEvent.isActionUp()){
    pEngine.setScene(GamePlayScene.CreateTheGamePlayScene(context,pEngine,camera_width, camera_height,GamePlayScene.LevelNumber+1));
    }
    return true;
    }};
    

    and here is the link for my game if you want to see how that works:
    https://market.android.com/details?id=com.ayham.blowangryshapes
    i only have one game play scene in the game and the levels are loaded as needed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using andengine and I have some sprites that change color when pressed.
I am using AndEngine. I have a Method that adds targets to the screne.
I am using AndEngine to add sprites to a scene. The sprites are all
I am using andengine and I have an animated Sprite. I use scene.animate(duration,0,5,1) to
I have written an application that plays music, using AndEngine. The annoying problem is
I'm developing a physics game using AndEngine with box2d physics engine. I have a
I would like to use AndEngine's particle system to create a splash(as in splashing
I'm using AndEngine to create a Live Wallpaper and I have everything set up
I am using java + AndEngine in my game. During the game i have
Would anyone share an example on how to implement GradienRectangle that would have different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.