Note that there are some explanatory texts on larger screens.

plurals
  1. PO- (BOOL)ccTouchBegan responds on simulator but not on device
    text
    copied!<p>I am working on a Pause screen menu for a game. After displaying the pause screen, I have the user touch the screen to hide the pause screen and resume the game. This works perfect on the simulator but doesn't work when I test on an actual device. It seems that the device doesn't respond to touches specifically for the pause menu. Every other part of the game works fine on both the simulator and device. It's weird how it does work on the simulator but not on the device. This is the code I have for the pause screen:</p> <pre><code>- (id)init { if ((self = [super init])) { CGSize windowSize = [[CCDirector sharedDirector] winSize]; //windowSize.height = 768.0; //windowSize.width = 1024.0; CCSprite *whiteScreen = [CCSprite spriteWithFile:@"OutOfTime.png"]; whiteScreen.position = ccp(windowSize.width / 2, windowSize.height / 2); [self addChild:whiteScreen]; CCLabelTTF *touchToDismiss = [CCLabelTTF labelWithString:@"Touch screen to continue" fontName:@"Marker Felt" fontSize:30]; touchToDismiss.color = ccBLACK; touchToDismiss.position = ccp(windowSize.width / 2, 20); [self addChild:touchToDismiss]; } return self; } - (void)onEnter { [super onEnter]; [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:NO]; } - (void)gameOverWithScore:(NSInteger)score { CGSize windowSize = [[CCDirector sharedDirector] winSize]; //windowSize.height = 768.0; //windowSize.width = 1024.0; CCLabelTTF *touchToDismiss = [CCLabelTTF labelWithString:@"Game Over" fontName:@"Marker Felt" fontSize:75]; touchToDismiss.color = ccBLACK; touchToDismiss.position = ccp(windowSize.width / 2, windowSize.height / 2 + 40); [self addChild:touchToDismiss]; NSString *scoreString = [NSString stringWithFormat:@"Final Score: %d", score]; CCLabelTTF *scoreLabel = [CCLabelTTF labelWithString:scoreString fontName:@"Marker Felt" fontSize:60]; scoreLabel.color = ccBLACK; scoreLabel.position = ccp(windowSize.width / 2, (windowSize.height / 2) - 40); [self addChild:scoreLabel]; } - (void)setMessage:(NSString *)message { } - (void)dealloc { [super dealloc]; } - (BOOL)ccTouchBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"haha"); return YES; } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload