sprite kit - wait action not working -
i have ball start moving impulse want wait 3 seconds before doing so. put code thinking it's not working.
//add sprite scene [self addchild:ball]; skaction *wait = [skaction waitforduration:3]; [self runaction:wait]; //create vector cgvector myvector = cgvectormake(10, 25); //apply vector ballphysics body [ball.physicsbody applyimpulse:myvector];
wait applies other actions.
if want apply impulse after wait need add block action. once have wait action, , applyimpulse action put these 1 sequence. make sense?
//add sprite scene [self addchild:ball]; skaction *wait = [skaction waitforduration:3]; skaction *applyimpulse = [skaction runblock:^{ //create vector cgvector myvector = cgvectormake(10, 25); //apply vector ballphysics body [ball.physicsbody applyimpulse:myvector]; }]; [self runaction:[skaction sequence:@[ wait, applyimpulse ]]];
Comments
Post a Comment