by grixtanian » Tue Mar 06, 2012 12:26 am
Thanks once again. Works perfectly. One last question if you don't mind.
I am using a class which extends Sprite, and I have an instance of it with a body attached. I created the class because I need to have a sprite object, but I need some functionality related with each and every instance of the sprite.
So I have:
CustomSprite image;
and in CustomSprite I have a method returnNumber(); which returns a desired int value.
and I created a body using this object, therefore:
PhysicsFactory.createCircleBody(this.mPhysicsWorld, image,BodyType.StaticBody, PLAYER_FIXTURE_DEF);
My question is, is there a way to access returnNumber at collision time? Something like this:
if(BodyA.getUserData() == "theBox" && BodyB.getUserData() == "theSphere"){
//ACCESS returnNumber() NOW
}