2D Character Controller

Sometime at the start of 2016 me and a friend decided we wanted to make a 2D platformer. I had always wanted to understand what it took to create a character controller from scratch so I spent the time to create one!

This is clearly a solved problem so I won’t get too much into the details of it however, I’m still proud of the work I accomplished. I was able to get player collision and movement down using raycasts to valid movement in the target direction.

It is a little hard to see but the red rays coming out of the player in the target direction are used to control the player collision.

I was also able to get platform movement working by checking whether the player was standing on a platform with a downward raycast and then applying it’s velocity to the players.

I think the trickiest part for me was getting slopes to work. Having the player not stutter and be able to walk up and down the slope smoothly was pretty tricky but I think I got a good result in the end.

I had a ton of fun working on this and understanding exactly how basic collisions were handled. Hopefully in the future I’ll be able to continue working with things I have built from scratch. I have really been enjoying understanding exactly how things are working behind the scenes. I want to take this project further and begin to do some more innovative things with a 2D platformer so hopefully I’ll have something cool I can go into more detail about in the near future.

Thanks For Reading!