Player / ragdoll class, for use in games.

Hello everyone, I’ve decided to give to you the code for my player class which I used in my portal 2d project, this is the character without the gun and teleports, there are several functions I’ve added to hopefully make it easier to use, such as the character movement is handled by Player:move(x,y). It’s quite messy code, I apologise but hopefully its fairly easy to integrate, it needs a global called scr which is the translation of the screen. If not used, set it to vec2().

The class includes a joystick which controls the players movement, you’ll need to add your own button to make him jump if you wish, this can be done using the y value in the Player:move(x,y) function, around 2000 is a good mark.

Here’s the old code and an example: http://pastebin.com/VWXMmAdz

Video of new ragdoll: http://www.youtube.com/watch?v=oPZmmdrjjUk

I have been looking into trying to figure out an efficient way to do some sort of ragdoll or character with the 2D physics engine! Thanks for your code!

Well @aciolino seeming as you’re interested here’s an updated version with better walking (added knee joints) and added a jump button.
Here’s the pastebin link (still waiting for the codea community :slight_smile: ):
http://pastebin.com/ffaUUaDA
As you’ll see there’s a staircase, I’m working on getting him to walk up stairs, im also thinking of adding feet and ankle joints… Also I’ve taken all textures out for adaptability but the head texture still remains

heh - I walked (well, stumbled) to the end of the world and fell off - pretty nice job!

Is the walking motion not smooth for you? If walking on a flat surface for me its a nice looking transition but up slopes/down slopes/stairs are terrible :frowning: