Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a scenario where I have red coin in a Carrom board game which should be moved outside of the visible window when it is pocketed, also if any coin either white or black is not pocketed in the next shot, the red coin should be replaced in the center of the board.

Now my problem is WHEN I apply the setXForm() method to move the b2body of the red coin outside of the visible area of my flash window.It moves,there is no problem in moving the body,but WHEN i replace the b2body and sprite after the event of no coin falling , the b2body is detached and works as a separate entity having no connection with the sprite of the red coin.

I'm not getting a clue as to what is happening, that is why I thought I'd try posting this here.

share|improve this question

2 Answers 2

up vote 0 down vote accepted

Do you destroy the unused body? They are not automatically destroyed if the sprite that "owns" it is removed (precisely because it doesn't own it at all, the Box2D world does).

share|improve this answer
    
well, I solved it . The problem was because i had used an actor class along with an array for all the coins.And when I removed the coins I removed it from the array. So I just had to ensure I did not remove from the array. :) –  Vishnu Aug 27 '10 at 5:04

I don't know anything about the flash port, but is it possible that you are using an older version of box2d (or the port is from an older version) and you moving the b2body outside of the range of the b2World?

If I remember correctly, you had to specify min/max coordinates for the world, and if anything went outside this range it was no longer simulated. I'm not sure what happened at this point if you changed their position back into the world.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.