Hey all, here’s a quick tip on how to fix an issue with your hitboxes in Flixel. Let me know if you’ve heard this one before.
The Problem
Have you ever heard of an issue where you’re working on your game and after your character moves outside the initial screen size, your character doesn’t collide with anything anymore? This is an issue I encountered recently, and with help from the Flixel community, it was a simple fix, which I will share with you.
The World Bound Fix
The fix is one line of code. This line will update the positions so that Flixel registers your overlaps and collisions once again. See below:
See? Easy right? That’s the fix. By updating the world bounds, we allow the quadtree, which is being used for collision detection to properly register the collisions you wish to make once again. I hope it helps you with your game.
With that said, have a good one and take care!! Good luck game making!!