Hi everyone.
I have some trouble with my game (using Cocos2D). I have an introduction, then it will go to the game afterward. The thing here is, on the simulator, it always appears at real-time when it switches scene Intro to GamePlay. But in the actual phone, I know it would be slower and take more time to switch. But before the player can see the GamePlay scene, the timer for the game starts to count,( the player has 30 seconds to play the game), and then music also starts already before the screen appears. Then when it goes to the GamePlay screen, the timer will still be 30 seconds, but it actually passes few seconds. So that is why when the player sees the timer show 4 seconds ( or sometimes 3 or 6) it already display that he loses. He would not know the timer actually started before he saw the screen.
I don't know how people solve this problem. Could anyone help me out. Thank you so much.
PS: I think what about I put a loading page while it loads like other games, But bad thing is I don't know how to do so. I just have an idea.
This is my timer code, these are in init
[self schedule:@selector(endGame:) interval:1.0f]; [self schedule: @selector(timeCounter:) interval:1.0f];
-(void) timeCounter:(int) dt
{
timer -=1;
LabelAtlas *label2 = (LabelAtlas*) [self getChildByTag:kTagSprite2];
[label2 setString: [NSString stringWithFormat:@"%d", timer]];
}
//This determines when the game ends
-(void) endGame:(ccTime)dt
{
milliSeconds++;
int i = 30;
if (milliSeconds == i)
{
[currentSound stop];
LostScene *loser = [LostScene node];
[[Director sharedDirector] replaceScene:[FadeTransition transitionWithDuration:0.1 scene:loser]];
}
}