So I have this situation:
That’d be two frames. When checking collisions, in frame 1 I can see I’m on the floor. In frame 2 I can also see I’m in the floor. So here is the problem, in both frames the player is on the floor. But between the frames, he isn’t.
Now, moveBy()
was designed to solve this problem. To check for collidable objects in the middle.
The issue is, moveBy()
is a bit broken. It doesn’t take into account certain situations. This is one of them.
The way it works, it first checks pixel-per-pixel the x-axis, and then the y-axis. Thing is, just doing that won’t solve my problem.
They way it’d have to be solved is, each time I move the x-axis by one, check if there is or there isn’t a floor.
So for moveBy to be accurate, it’d have to check each pixel in the whole square area of the movement… which is expensive.
Just wanted to point out that issue. MoveBy isn’t perfect, don’t always rely on it.
I’m trying to figure out a solution now. I’m thinking right now maybe I can check on which tile I am of the grid, see which tiles I’ve gone through, and if there’s floor below or not.