Surprising behavior using HC
Posted: Sun Apr 03, 2016 4:07 pm
Hi everyone!
In my journey for learning LÖVE, I started creating a simple platformer. I started yesterday, so I'm fairly new to this. I'm using Tiled to get a simple map with platforms, including an Object layer with polygons to mark them.
I import all of that using STI and it works like a charm. I didn't want to use bump, because I want to manage slopes and I'm not sure you can do that. I didn't use box_2d either. Well I tried, but after a while I thought it was too complicated for my first day. I opted for HC. After a while I understood the core concept so I wrote a STI plugin to automatically create my collision polygons. I added a fake player represented by a rectangle. I'm using HC to get the shapes colliding with my player and react accordingly ( So far, just setting the vertical velocity to zero ).
Everything works great, my character falls from the spawn point and stops on the platform. But a few seconds later, no collision is detected anymore. I added some 'print' to see if at least one shape was detected as colliding, but it's always the same, At first I see it all, but a few seconds later, nothing is detected anymore.
Also I noticed during my debugging process that adding 'print' in some part of the code made the bug appear later. So I suspect something about the framerate, but I still don't know LÖVE enough to be sure.
I couldn't find something online about this kind of problem, so here I am. Also if you think that HC for a simple platformer is not fitting, tell me which library would.
I included the .love file if you want to check it out yourselves.
Thank you all in advance!
In my journey for learning LÖVE, I started creating a simple platformer. I started yesterday, so I'm fairly new to this. I'm using Tiled to get a simple map with platforms, including an Object layer with polygons to mark them.
I import all of that using STI and it works like a charm. I didn't want to use bump, because I want to manage slopes and I'm not sure you can do that. I didn't use box_2d either. Well I tried, but after a while I thought it was too complicated for my first day. I opted for HC. After a while I understood the core concept so I wrote a STI plugin to automatically create my collision polygons. I added a fake player represented by a rectangle. I'm using HC to get the shapes colliding with my player and react accordingly ( So far, just setting the vertical velocity to zero ).
Everything works great, my character falls from the spawn point and stops on the platform. But a few seconds later, no collision is detected anymore. I added some 'print' to see if at least one shape was detected as colliding, but it's always the same, At first I see it all, but a few seconds later, nothing is detected anymore.
Also I noticed during my debugging process that adding 'print' in some part of the code made the bug appear later. So I suspect something about the framerate, but I still don't know LÖVE enough to be sure.
I couldn't find something online about this kind of problem, so here I am. Also if you think that HC for a simple platformer is not fitting, tell me which library would.
I included the .love file if you want to check it out yourselves.
Thank you all in advance!