Я пытаюсь сделать свое первое приложение cocos2d, chipmunk ipad
Я установил спрайт "ball" в своем файле .h так:
// HelloWorld Layer
@interface
HelloWorld : CCLayer {
cpSpace *space;
CCSprite *ball;
}
и я его перемещаювот так (на ощупь):
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
for( UITouch *touch in touches ) {
CGPoint location = [touch locationInView: [touch view]];
location = [[CCDirector sharedDirector] convertToGL: location];
// Determine speed of the target
int minDuration = 2.0;
int maxDuration = 4.0;
int rangeDuration = maxDuration - minDuration;
int actualDuration = (arc4random() % rangeDuration) + minDuration;
// Create the actions
id actionMove = [CCMoveTo actionWithDuration:actualDuration
position:ccp(location.x, location.y)];
id actionMoveDone = [CCCallFuncN actionWithTarget:self
selector:@selector(spriteMoveFinished:)];
[ball runAction:[CCSequence actions:actionMove, actionMoveDone, nil]];
[ball retain];
}
}
Когда я запускаю с отладчиком, я получаю это:
2011-06-29 20:44:04.121 ballgame[3499:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[HelloWorld spriteMoveFinished:]: unrecognized selector sent to instance 0x605a3e0'
Кажется, что работает на пару касаний, а затем, кажется, сбойтак что, возможно, утечка памяти?Любые предложения или советы действительно помогут, это как мое первое приложение.
Ура!