Problem trying to move a CCSprite circle in Cocos2d
- by thyrgle
Hi,
So I am trying to move a CCSprite (which has the picture of a circle and is 32 by 32 pixels) with ccTouchesBegan. I have tried the following:
-(void) ccTouchesBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
CGPoint location = [touch locationInView:touch.view];
if ((location.x <= L1Circle1.position.x + 32 && location.x >= L1Circle2.position.x - 32) && (location.y <= L1Circle1.position.y + 32 || location.y >= L1Circle2.position.y - 32))
{
L1Circle1.position = ccp(location.x, location.y);
}
}
But, when I touch the screen in the simulator nothing happens... What am I doing wrong?