title: unlocking levels in Android Game logic
body: <p>I have a level scene that i allow the user to select a level.</p>
  
  <p>But to move on to the next level the user must complete the level before it.</p>
  
  <p>Right now the first level which is automatically unlocked.</p>
  
  <p>When it is completed i want unlock the second level. and when the second level is completed, unlock the third level.</p>
  
  <p>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.</p>
  
  <p>i could use some help on the logic behind this.</p>
  
  <p>Any can help me out?</p>
  
  <p>EDIT:</p>
  
  <p>In my gameplay scene when is game is completed i call this to sharedpreference</p>
  
  <pre><code>editor.putString("level_completed"+level, "unlocked");
  editor.commit();
  </code></pre>
  
  <p>Then i do..</p>
  
  <pre><code>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");
      }
  }
  </code></pre>
  
  <p>in the level selection scene to check if the level is unlocked.</p>
  
  <p>This doesnt seem to be working to well. A level that should be unlocked isnt unlocked.</p>