Closed danielgholmes closed 4 years ago
Hi! Thanks for the detailed report. It's a genuine bug, introduced after implementing active sprites as a linked list. Only active sprites get collision flag cleared at the beginning of each frame. So if you disable a sprite and reassign it in the same frame, it doesn't get its collision flag cleared. That's easy to fix.
Great! Thanks for your assistance!
Hi,
I came across this issue after upgrading to Tilengine v2.8.4. I'm using the Python bindings, but it seems the issue is with Tilengine itself, I thought it would be best to post the issue here.
What I am finding is that collision detections seems to persist even for sprites that have been disabled. For example, in the game I am making, a projectiles sprites registers a collision with an enemy sprite, and the projectile sprite is subsequently disabled. Then when creating a new projectile using
TLN_GetAvailableSprite
, it uses the previously disabled one for a new projectile. This is expected. But what I have found is that the collision detection on the original sprite persists, so that the new sprite immediately registers a collision and gets disabled.The Python code below reproduces the issue:
If I use a separate sprite index variable so that a new index is used each time, there is no problem. Obviously this is not a suitable solution because sprite indices need to be reused. But I included it here to help illustrate the issue.
I have been able to reproduce the issue on macOS 10.15.6 and Ubuntu 20.04. I'm using the latest version of the Python bindings.
Please advise if I am missing something or if this is a genuine bug.