2 finger multitouch id clash problem


#1

Hi, I am using multi touch, one finger to move the character around with moved and second finger for tap function. when I place my first finger ( and dont move it) and do a tap with other finger it says that I moved the first finger and also says that I touched with second finger. below is the code. I used getID to get the fingers

void Hero::ccTouchesBegan(CCSet *_touches, CCEvent* event)
{
        //gesture
        CCArray *allTouches = xtAllTouchextromSet(_touches);
        CCTouch* touch = (CCTouch *)allTouches->objectAtIndex(0);

        if(touch->getID() == 0)
        {
            CCLOG("touch 1");
        }

        if (touch->getID() == 1)
        {   
            CCLOG("touch 2")
        }        
}

void Hero::ccTouchesMoved(CCSet* _touches, CCEvent* event)
 {

    //gesture
    CCArray *allTouches = xtAllTouchextromSet(_touches);
    CCTouch* touch = (CCTouch *)allTouches->objectAtIndex(0);

        if(touch->getID() == 0)
        {
            CCLOG("moved 1"); 
        }

        if (touch->getID() == 1)
        {
            CCLOG("moved 2");
        }
}  

and this is the out put

Cocos2d: touch 1
Cocos2d: touch 2
Cocos2d: moved 1

i used memory address solution mentioned http://www.cocos2d-x.org/boards/6/topics/24504 and still it gives same problem ….

How can I avoid this? thanks


#2

no takers?? :frowning: