quinton-ashley / p5play

JavaScript game engine that uses q5.js/p5.js for graphics and Box2D for physics.
https://p5play.org
GNU Affero General Public License v3.0
661 stars 183 forks source link

`sprite.joints.removeAll()` doesn't work correctly #331

Closed Dukemz closed 1 month ago

Dukemz commented 1 month ago

If a sprite has multiple joints, running removeAll() doesn't actually remove all of them.

I suspect the reason why this happens is because the function runs joint.remove() on each of the joints in the sprite.joints array with a for/of loop, but since this removes them from the array immediately, the positions in the array are shifted and thus the loop skips some joints.

quinton-ashley commented 1 month ago

You are correct, will fix in the next update

quinton-ashley commented 1 month ago

Fixed in v3.22.15 !