JGugino/Luci2D

BUG02 - Strange collision behaviour between GameObjects

JGugino opened this issue · 1 comments

When using built-in GameObject collision methods (eg. onCollisionEnter(), onCollisionStay(), onCollisionExit()) and also having many GameObjects active at the same time is causing GameObjects to not fully complete the instructions within those methods. I believe this issue is being caused by all aspects of the framework run off a single thread, so I think moving Object collision to its own dedicated thread should resolve the issue.

Note: Collision works slightly better but still not ideal when setting up GameObjects one at a time instead of using the TileMap feature. But this still the most efficient way to do set things up, I should have a fix out soon if all things go well.

The collision methods that are inside the GameObject class are now deprecated, they still function as they used to by will soon be removed completely. You can use the new collision methods found within the GameObjectHandler. The objectsColliding method takes in 2 Strings(the IDs for the objects you want to check), this method returns a boolean whether they are colliding. The other 2 methods aim to do the same task with slightly different functionality, these methods are both called collidingWithTileMap and both take in a String for the ID of the colliding object and also the TileMap. However one also takes in anw interface for ICollisionAction which will allow you to perform an action when a collision happens. This version of the method doesn't return anything, but the version without the interface returns a boolean for whether a collision happened.