Jump to content

Bodies of invisible sprites are not updated


Recommended Posts

I noticed some odd behaviour of sprite bodies. If I take a sprite, set visible to false and start moving it around while rendering the body with game.debug.renderSpriteBody, the body will actually stay where it was. This is especially strange when I use kill to temporarily depose of a sprite, because the body will still be present in the game.


This lead to two bugs in my project:

1. My invisible enemies are now almost impossible to hit, because they don't carry their bodies with them :D

2. Somehow the body of my projectile is able to collide on it's last position, when I used reset after using kill. I was not able to reproduce this in the examples, so I don't know what strange factor is contributing to that.


I destroy my projectile now so this doesn't happen, though I would have liked to reuse it. The invisible enemies could be achieved with empty frames, but I don't like that solution either.

So basically I want to know if this is supposed to happen and if so, how I could implement enemies that can turn invisible without needing an empty frame in their spritesheet.

Link to comment
Share on other sites


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...