title: Counting the nodes for game over
body: <p>In my game I have three balls and I want the game to be over when there is only one left. I have this code below to make it end when there's none left. I tried some code below to make it so it ends when theres one left but it's not working properly. Any ideas on how to solve this?</p>
  
  <p>This is the code I'm using to determine if there isn't any balls left:</p>
  
  <pre><code>-(BOOL)isGameWon {
  for (SKNode* node in self.children)
      if ([node.name isEqualToString:@"ball"])
          return NO;
  return YES;
  }
  </code></pre>
  
  <p>This is the code I tired to use to check if there's only one left:</p>
  
  <pre><code>-(BOOL)isGameWon {
  for (SKNode* node in self.children)
      if ([node.name isEqualToString:@"ball"])
          node = 1;
  return YES;
  }
  </code></pre>