sprite kit - SKSpriteNode removeFromParent in touchesEnded -
i have issue removing skspritenode it's parent when touch detected on skspritenode. here code:
-(void)touchesended:(nsset *)touches withevent:(uievent *)event { (uitouch *touch in touches) { cgpoint scenelocation = [touch locationinnode:self]; if ([_tabledonebutton containspoint:scenelocation]) { nslog(@"here"); [self removeitemsfromview]; _headernode.portlabel.text = [ipgamemanager sharedgamedata].world.player.port.name; [_portnode show]; } sknode *nodeinport = [_portnode nodeatpoint:[touch locationinnode:_portnode]]; if ([nodeinport.name isequaltostring:@"marketbutton"]) { [self showmarket]; } } } in showmarket function, 'done' skspritenode added user can leave market when he/she wants to. can see above, if _tabledonebutton contains touch location, should call removeitemsfromview function contains [_tabledonebutton removefromparent];. have special when removing nodes way?
another issue: seems removed ~1 second later. happens when run [node removefromparent]? if set skspritenode nil after call [self removeitemsfromview] works fine. shouldn't have that?
Comments
Post a Comment