And I haven’t done any writing today! Absolutely terrible.
So I wanted to go and do something fun again, so I decided to prototype a simple idea for a possibly complicated platformer, using a simple prototype. All fine and dandy, LÖVE is a breeze to work with. Of course I needed collision detection, because we can’t have our character falling through floors and walking through walls, so I wanted to go and implement that. But not by learning from the web, oh-ho no! I wanted to try and figure it all out myself.
My first try… didn’t go well at all. I didn’t think it through, messed up, and basically had no idea what I was doing. Second try was a better one, now reverting to the previous position if the current position caused it to overlap/collide with another object. Cool, but due to framerate issues the character often floats above the platform by a few pixels. The next version solved this, by clipping it to edge if it collided. All fine and dandy, but walking into a wall (colliding from the side) causes it to clip either up or down, and I have no idea why it’s happening. It shouldn’t be, but it is, and it’s all just so hard.
I’m considering stopping being stubborn and just looking something up, but it’d be so cool if I could do it on my own. So much fun, too, and the best understanding possible, since instead of learning how it work, I’d be figuring out how it works.
EDIT: Okay, I decided to take a look at the code one more time before going to bed. Guess what? I solved it. Problem was with Y being resolved first, so X collisions were resolved as if they were Y collisions. I separated X and Y movement and there respective collision detection/resolving blocks, and huzzah, it works!
I’ll try to write tomorrow… I hope!