Hi im currently working on a game where my player collects coins among other things. I have implemented collision detection for the coins and that is working, however when i collide with a coin i want to move the coin to the score label. The score label is located in the top right hand corner of my screen. The code i use for the collision can be seen bellow. The game is being developed using sprite builder which is why the collision may look different.
-(bool)ccPhysicsCollisionBegin:(CCPhysicsCollisionPair *)pair player:(CCNode *)Player coin:(CCNode *)coin
{
coin.physicsBody.Sensor = YES;
NSLog(@" scoreLabel x:%f y:%f", _scoreLabel.position.x,_scoreLabel.position.y);
id move = [CCActionMoveTo actionWithDuration:1.0f position:ccp(_scoreLabel.position.x, _scoreLabel.position.y);
NSLog(@"coin positon x:%f y:%f", coin.position.x, coin.position.y);
[coin runAction:move];
return YES;
}
The _scoreLabels position is 177, 20 ive logged this to check its correct. The issue is when the coins moves it is moving to the left and and down, its not moving to the point specified. Thank you for any help and suggestions.