Ok, after making my project Generic Platformer (please check it out) I noticed that every platformer including mine use the same engine, so I decided to try to make my own. Here's what I came up with. It is highly customizable, with little to no bugs!
if you use this code, consider giving credit! Also I highly encourage you to try to understand what is going on and read the notes inside the project! 100% by me!!!