質問

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?

役に立ちましたか?

解決

Try this

[NSThread sleepForTimeInterval:1.0];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top