Hello pabloruiz,
this is the code which i used in touches moved function..
here the touches is based on accelerometer status,, if accelerometerenabled is true then the touches will not work, if it is false accelerometer will work.
****
if(!current_statusaccelerometer )// here accelerometer is false
{
UITouch* touch = [touches anyObject];
CGPoint location = [touch locationInView: [touch view]];
CGPoint point=[[CCDirector sharedDirector] convertToGL: location];
CGPoint paddle_point=paddle->shape->body->p;
float diff=paddle->shape->body->p.x-point.x; paddle->shape->body->p.x-(480-point.y*1.5);
paddle_point=cpv(point.x,paddle_point.y);
cpv((480-point.y*1.5),paddle_point.y);
if( paddle_point.x<440 && paddle_point.x>40)
{
paddle->shape->body->p=paddle_point;
Paddle * thisPaddle=paddle->shape->data;
thisPaddle->paddle.position=thisPaddle->shape->body->p;
[self moveBallWithPaddleByDifferance:diff];
}
}
****
-(void)moveBallWithPaddleByDifferance:(float)diff // this method is related moving the object
{
for (int i=0; i<_Ball_Count_; i++)
{
if(balls[i]->stage==kPauseBall)
{
balls[i]->shape->body->p=ccp(balls[i]->shape->body->p.x- diff,paddle->shape->body->p.y+12);
}
}
}
*****
suggest me if there is any corrections