for the past few days steemdya had been overshooting on the wall while colliding. if you imagine the player to be a rectangle, it should be physically impossible for any part of that rectangle to go through other objects.
i don't know whether i was doing something wrong, or pygame is just weird. but pygame's collision detection always came after a single frame. so by the time steemdya stops running, it's already too late. part of him would always go through. to make matters worse, depending on his location one frame before collision, how much of him went through was completely unpredictable. such uncontrolled randomness can be catastrophic (for any game).
so i started predicting steemdya's next location whenever he was moving. because pygame would always detect collision on the next frame, i simply had to double the distance.
by predicting where steemdya will be on the next frame, and limiting his movement speed according to the leftover distance between him and the wall, i could solve the issue.
i thought about simply ignoring it because it's only a few pixels. some will even consider it to be negligible. but stuff like this often drive me crazy (yes, i'm weird).
sometimes i worry i might've gotten myself into a giant mess by not using unity. pygame is a mere library that is horribly outdated. in engines like unity or unreal this wouldn't even be an issue.
but once you start on something, you should finish it (especially a gamedev project). there's always something to learn. with steemdya i already feel like i've improved as game developer and can do a better job on the next project.
today i don't have any personal stuff to share so i decided to have this instead. technical stuff can be boring but it is what it is. let's hope something exciting happens tomorrow. thanks for coming. have a nice day.
We're indiegame developers.
is the artist. I'm the programmer.
You can follow the progress here (youtube link)