hackenstein

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.