ios - How can I add a delay before it continues -
is there way in normal obj-c or cocos2d make delay inside if-else
block?
if ([self isvalidtilecoord:ctilecoord] && ![self iswallattilecoord:ctilecoord]) { [self addchild:circle0]; //wait 2 seconds //perform task }
just simple lag wait between 2 tasks, or stalling action. there simple way this?
you can use performselector: withobject: afterdelay:
method delay tasks:
if ([self isvalidtilecoord:ctilecoord] && ![self iswallattilecoord:ctilecoord]) { [self addchild:circle0]; //wait 2 seconds [self performselector:@selector(continuetask) withobject:nil afterdelay:2.0]; }
and in selector method:
-(void)continuetask { //perform task }
Comments
Post a Comment