How to reset buttons when using touchesBegan
Posted
by
FireStorm
on Stack Overflow
See other posts from Stack Overflow
or by FireStorm
Published on 2014-08-24T04:16:37Z
Indexed on
2014/08/24
4:19 UTC
Read the original article
Hit count: 126
ios
|sprite-kit
When I use touchesBegan on my sprite kit game the buttons press down fine the first time but are unresponsive the second time, how do I "reset" these buttons if you will. Buttons are as follows:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [touches anyObject];
CGPoint location = [touch locationInNode:self];
SKNode *node = [self nodeAtPoint:location];
if ([node.name isEqualToString:@"Button"]) {
[self runAction:[SKAction playSoundFileNamed:@"sound" waitForCompletion: NO]];
....
Thanks for your help!
© Stack Overflow or respective owner