I was wondering since quite some time: Is there any good way to check whether an object is not touching a solid?
Example: When the player collides with a solid, the text changes to "is on collision". Now when the player moves (or jumps or falls) away from the solid and does not touch it anymore, the text is supposed to change to "is NOT on collision".
Below you can see one possible solution, but I think this is very hard on the memory because at every tick, it has to check every single solid whether they are the nearest to the player and then whether they are (almost) touching the player. Or am I misunderstanding this?
I am looking forward to better ideas. Thank you!
https://www.dropbox.com/s/ww2safdaowxht ... .capx?dl=0
Develop games in your browser. Powerful, performant & highly capable.
One option might be:
Player Is Overlapping Solid at offset (1,1) -> set text to 'On Collision'
System Else -> set text to 'not on collision'
Thank you for your suggestion. I tested it and it adds 1 additional collision check per tick for every solid in the level. Not too shabby.
But in the meantime I have found another solution which adds no additional collision checks per solid.
When the player collides with a solid, a helper object is created at the same position of the solid, but with two differences: It is a little bigger than the solid and it does not have solid behaviour so that the player can overlap with it. So now you only have to check one single object for overlapping with the player. If the helper object overlaps with the player, the solid "kind of overlaps" with the player, too. If the helper object suddenly doesn't overlap with the player anymore, neither does the solid. In that case, the helper object is destroyed and the text is changed to "not on collision".
Now of course it's gonna get a little tricky when you have different types of solids with different forms and sizes but maybe rexrainbow's nickname plugin can be of help then. If I decide to investigate that matter further, I will check back to this thread.
https://www.dropbox.com/s/noyf149ldkgr5 ... .capx?dl=0