All,
I put together another little physics demo. If you go to my site www.ashatej.com, it is at the bottom of the demos section "Stickman Jump". The demo generates a random bunch of chain vertices to mimic random terrain and random platforms. Move the stickman by holding the mouse down to the left or right to make him go that way. If you mouse down between 60 and 120 degrees above the stickman (90 degrees being straight up) he will jump if he can. Mouse down on the stickman = no motion You can see the foot sensor at the bottom of the stickman (small white square). The code is all released wade stuff, no joints or extra add ons. Sometimes, the jumping is a little wonky (it seems like you should be able to jump, but the software doesn't think it is on the ground), but it should be good enough for a demo.I tested it on a PC with firefox and chrome and with a touch screen and it seems to work as advertised.
The whole demo is available for download as a zip file. The stickman graphics are free to use but were NOT released under CC0, so there are some restrictions. If you go to the demo credits, you can load "Robert Brooks" web page and look at the licenising information. Please respect the rights of the graphics copyright holder. There is some standard copyright stuff in the source code, but that's mine so feel free to do with it what you like. I don't use the online editor, so you have to know a little code to understand what is going on.
update
- changed how movement works. If you mouse down between 60 and 120 degrees above the stickman he will jump if he can. If the angle is anything else, the stickman will try to walk/run. mouse down on the stickman = no motion. The best way to move in the demo is to mouse down, get the guy moving and then move it upward a split second before you want to jump.
- changed jumping so directional, i.e. jump vector based on mouse location. Also, strength of jump is based on the angle. He jumps the strongest straight up, and a little less if jumping to side.
- changed run walk, so accelerates faster or slower based on whether the mouse is far away or close to the stickman
- changed the floor and platform routine so they are much more general. The random platforms are generated based on parameters in the level json file.change those setting to effect how long floor segments, how long platforms, how dramatic the rise or fall of the floor heights are.
If you have any questions regarding the demo, post them to this thread and I will try to get you an answer.
cheers - shri