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 7627057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:24:32+00:00 2026-05-31T05:24:32+00:00

I have a level scene that i allow the user to select a level.

  • 0

I have a level scene that i allow the user to select a level.

But to move on to the next level the user must complete the level before it.

Right now the first level which is automatically unlocked.

When it is completed i want unlock the second level. and when the second level is completed, unlock the third level.

i cant think of how i would go about doing this. i thought of sharedpreferences but dont know the logic i should use for this.

i could use some help on the logic behind this.

Any can help me out?

EDIT:

In my gameplay scene when is game is completed i call this to sharedpreference

editor.putString("level_completed"+level, "unlocked");
editor.commit();

Then i do..

String levelStatus = preference.getString("level_completed:"+level, "locked");

if(levelStatus.equals("unlocked")){

}else{
    if(level == 0){
        box.setUserData("unlocked");
}else{
        box.setColor(1.0f,0.0f,0.0f);
        box.setUserData("locked");
    }
}

in the level selection scene to check if the level is unlocked.

This doesnt seem to be working to well. A level that should be unlocked isnt unlocked.

  • 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-31T05:24:33+00:00Added an answer on May 31, 2026 at 5:24 am

    There are a number of ways you could approach it. If the progression is always linear (1, 2, 3, 4) then you could just store an integer for “max unlocked level” and then update it whenever you complete a level. Otherwise, you could also have many booleans like “level 2 unlocked” and when you complete level 1, you can set “level 2 unlocked” to true. Shared Preferences is definitely a reasonable way to go.

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

Sidebar

Related Questions

I have a scene that is displayed before a level, where the images are
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
I have just been getting into low level programming (reading/writing to memory that sort
How do you create a JavaFX application that (instantly) dynamically resizes? Right now I
i am using AndEngine. I have a scene that i would like to reuse
I have a scene that contains a group whose content consists of a large
I basically have 3 layers ( Window > Scene > View ) that each
I have a bunch of classes that retain an instance of the scene and
I have a level scene in my game in which I am selecting the
I have two scenes. Scene A is the game scene, where the level variable

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.