Ok so I'm trying to run a method called "centerCamera", but I get 1 warning - Gameplay (my file) my not respond to -centerCamera. I have this in my init method.
[self center:bunny.position];
And I have this is my method.
-(void) center: (CGPoint) position {
CGSize screenSize = [[CCDirector sharedDirector] winSize];
int x = MAX(position.x, screenSize.width/2);
int y = MAX(position.y, screenSize.height/2);
x = MIN(x, map.mapSize.width * map.tileSize.width - screenSize.width/2);
y = MIN(y, map.mapSize.height * map.tileSize.height - screenSize.height/2);
CGPoint point = ccp(x, y);
CGPoint center = ccp(screenSize.width/2, screenSize.height/2);
CGPoint difference = ccpSub(center, point);
self.position = difference;
}
Thanks in advanced :)