I'm implementing a Contact Listener with Box2d which is a C++ .mm file.
Whenever two bubble's collide, I want to know so I can execute something. Here is my code:
void ContactListener::BeginContact(b2Contact* contact)
{
b2Body* bodyA = contact->GetFixtureA()->GetBody();
b2Body* bodyB = contact->GetFixtureB()->GetBody();
if (bodyA->GetUserData() != NULL && bodyB->GetUserData() != NULL)
{
BubbleSprite* bNodeA = (BubbleSprite*)bodyA->GetUserData();
BubbleSprite* bNodeB = (BubbleSprite*)bodyB->GetUserData();
BOOL oneIsBeingTouched;
if(bNodeA.isDrag == YES || bNodeB.isDrag == YES) oneIsBeingTouched = YES;
...
BubbleSprite's have the property BOOL isDrag
which indicates whether or not they are currently being dragged by a user. The problem I get is:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason:
'-[CCSprite isDrag]: unrecognized selector sent to instance 0x1ed504a0'
BubbleSprite is a subclass of CCSprite. isDrag is properly declared and synthesized in its file. Does anyone have any ideas on what's going on? Thanks