-
[Flash 9 is required to listen to audio.]
Depeche Mode - Now This Is Fun
-
998,001
If you divide 1 by the number 998,001, you get a list of all the three digit numbers in order except 998. See Wolfram.
-
By the end of my second term, we will have the first permanent base on the moon and it will be American.
– Newt Gingrich -
Improving CCMenuPopup
In chapter 2.3 of Building and Monetizing Game Apps for iOS, Todd Perkins demonstrates a method for displaying a popup menu to handle pausing the game. The popup is dismissed by overriding the ccTouchBegan method in the CCMenu subclass:
-(BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
if (![super itemForTouch:touch])
{
return NO;
}
NSArray *ancestors = [NSArray arrayWithObjects:self.parent,
self.parent.parent,
self.parent.parent.parent,
nil];
for (CCNode *n in ancestors)
{
if ([n isKindOfClass:[PopUp class]])
{
[(PopUp *)n closePopUp];
}
}
return [super ccTouchBegan:touch withEvent:event];
}This has the immediate effect of dismissing the popup when one of the menu items is touched. But with the popup and its menu removed from memory, the CCMenuItem for unpausing the game may not get the ccTouchEnded message in time before it is released. Without that message, the game is left is a paused state.
A better solution would be to replace the ccTouchBegin method with a ccTouchEnded method:
-(void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event
{
[super ccTouchEnded:touch withEvent:event];
if ([super itemForTouch:touch])
{
// Simplified
[(PopUp *)self.parent.parent closePopUp];
}
}Using this method, the action on menu item is properly handled before the popup is removed from memory.
-
The Singing House