hackenstein Posted November 19, 2013 Share Posted November 19, 2013 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 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 More sharing options...
rich Posted November 22, 2013 Share Posted November 22, 2013 Hmmm... try this - set "renderable = false" instead. It should hide the sprite but still update. Let me know if it works please If not I'll look into it. Link to comment Share on other sites More sharing options...
hackenstein Posted November 22, 2013 Author Share Posted November 22, 2013 Works! Thanks again Link to comment Share on other sites More sharing options...
Recommended Posts