I am currently attempting to complete a school project that uses SpriteKit. Since we are not given much time we were asked to create or modify the existing one from the book (Archer hitting balloons). I have successfully created a score hud display and I want to add the balls left to drop.
Here is what is in the book,
What I am trying:
I am sure there is a better way to accomplish this, especially since mine does update or drop any balls.
Can anyone help?
Here is what is in the book,
Code:
SKAction *releaseBalls = [SKAction sequence:@[[SKAction performSelector:@selector(createBallNode) onTarget:self], [SKAction waitForDuration:1]]];
[self runAction: [SKAction repeatAction:releaseBalls count:self.ballCount] completion:^{
[self gameOver];
}];
What I am trying:
Code:
_ballsLeft = 40;
while (_ballsLeft <0)
{
[self runAction:releaseBalls completion:^{
[self gameOver];
}];
_ballsLeft--;
_ballsLeftLabel.text = [NSString stringWithFormat:@"Balls Left: %04d", _ballLeft];
}
I am sure there is a better way to accomplish this, especially since mine does update or drop any balls.
Can anyone help?