title: AndEngine - Sprites remaining on screen...sometimes
body: <p>I'm attempting to create an Android game using AndEngine and have been having some successes. I'm trying to make a Target Tap clone which basically involves tapping a number of different targets on the screen to remove them (a bit like whack-a-mole).</p>
  
  <p>It works perfectly with one target and I can quite easily tap on it to remove it. The problem is that when there is more than one target on the screen they don't <strong><em>always</em></strong> disappear but adding points and everything else that is supposed to happen when you hit one works. </p>
  
  <p>I am removing the sprites in (as far as I know) the correct way which is to do it inside the runOnUpdateThread(...) block.</p>
  
  <pre><code>Game.runOnUpdateThread(new Runnable() {
       @Override
       public void run() {
  
          // Loop through all targets and check validity
          for (Iterator&lt;Target&gt; i = Game.this.mTargets.iterator(); i.hasNext();) {
  
              Target t = i.next();  // Target extends Sprite
  
              // If the target isn't valid, remove it from the scene and ArrayList
              if (!t.isValid()) { 
                  scene.unregisterTouchArea(t);
                  scene.detachChild(t);
                  Game.this.mTarget.remove(t);
              }
          }
  }
  </code></pre>
  
  <p>Sorry this is a little brief but because I'm unsure about where the problem lies I don't know what code to supply. I'm currently unable to test it on a real device but was wondering if this is could simply be something to do with the emulator because as far as I can tell the code is correct and I've tried so many things. If you need any help helping me, just let me know!</p>
  
  <p>Thanks</p>