phaser icon indicating copy to clipboard operation
phaser copied to clipboard

Phaser.Physics.Arcade.Body has no `destroy` method

Open gabehollombe opened this issue 12 years ago • 3 comments

Lines 542-545 of src/gameobjects/Sprite.js call this.body.destroy(), but Phaser.Physics.Arcade.Body has no destroy function defined. How should we destroy Arcade bodies? I'm happy to write the PR myself with some guidance.

    if (this.body)
    {
        this.body.destroy();
    }

Simple reproduction via JSFiddle here: http://jsfiddle.net/fekhZ/1/

gabehollombe avatar Mar 15 '14 12:03 gabehollombe

If you set Sprite.exists to false it will also set Sprite.visible to false and remove its body from the physics world (if it has one). If you set Sprite.exists to true it will also set Sprite.visible to true and add its body back into the physics world (if it has one).

this is in the v2 thats is under development

bojank avatar Mar 15 '14 15:03 bojank

Please don't submit a PR as this is already fixed in the dev branch!

photonstorm avatar Mar 15 '14 15:03 photonstorm

Thanks for the heads up, @photonstorm. =-)

gabehollombe avatar Mar 16 '14 00:03 gabehollombe