Try this
[NSThread sleepForTimeInterval:1.0];
Pergunta
I am making a game, and I am trying to add a gravity effect. This is the code I have so far
CGRect Bunny = self.Bunny.frame;
CGRect platform = self.platform.frame;
if (CGRectIntersectsRect(Bunny, platform)){
}else{
sleep(1);
self.Bunny.center = CGPointMake (_Bunny.center.x + -0, _Bunny.center.y + 1.5);
[self Call];
}
And the call function just does this so there is no error
-(void)Call{
[self Gravity];
}
But the sleep code does not work. Could anybody tell me what I am doing wrong, or another way to do this?
Solução
Try this
[NSThread sleepForTimeInterval:1.0];