so i made some changes. thanks for your comments by the way
😀 i have one problem left. i think instead of making joints in between each other, they are joining with themselves because none of them are joining together, and the game slowed down a bunch. here's the new code.
Code:
for (var dd:b2Body = m_world.m_bodyList; dd; dd = dd.m_next) {
if (dd.m_userData is Water&&bb.m_userData is Water){
var ddPoint:b2Vec2 = new b2Vec2(dd.GetPosition().x * m_physScale, dd.GetPosition().y * m_physScale);
var bbPoint:b2Vec2 = new b2Vec2(bb.GetPosition().x * m_physScale, bb.GetPosition().y * m_physScale);
joint = new b2DistanceJointDef();
joint.Initialize(dd, bb, ddPoint, bbPoint);
}
}
it at least runs, but it's basically pointless unless the joints are made with each other. bb by the way is "var bb:b2Body = m_world.m_bodyList". so basically the same as dd, except the For loop for dd is inside the For loop where bb is made. I want to have each object made be bb, and each object bb touches be dd. I hope that makes sense
🙂