By this point, we have moles that can be spawned, animated, and reset. What about the real fun, the mole thumping? For that, we look at the
MXMole.m
file, where all of the mole touch handling is coded:
Filename: MXMole.m
#import "MXMole.h" @implementation MXMole @synthesize parentHill; @synthesize moleSprite; @synthesize moleGroundY; @synthesize moleState = _moleState; @synthesize isSpecial; -(id) init { if(self = [super init]) { self.moleState = kMoleDead; [[[CCDirector sharedDirector] touchDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:NO]; } return self; } - (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event { CGPoint location = [touch locationInView:[touch view]]; CGPoint convLoc = [[CCDirector sharedDirector] convertToGL:location]; if (self.moleState == kMoleDead) { return NO; } else if (self.moleSprite.position...