Stickman one way platforms demo
Shri

All,

I put together another little physics demo. If you go to my site www.ashatej.com, it is at the bottom row of the demos section "Stickman OneWay".

The demo has our hero doing his usual thing, but the platforms are now "One Way", i.e. if he jumps from below, he should go through the platform and then land on it while falling. In summary, these are the changes.

  • The stickman is now made up of three fixtures head, body and foot. Changed collision method so collisions with foot signal that the scene object "isGrounded" (and therefore can move or jump). This seems to have removed some of the "wonkiness" from previous demos regarding jumping.
  • Head fixture used to determine if can jump through a platform. If collision occurs with a head and platform, set all stickman fixtures to be sensors, This disables collision resolution. When stickman starts falling again, then change all fixtures back to not sensors. Used falling threshold of 3 m/s because 0 would sometimes cause stickman to "stick" in middle of platform.
  • Improved floor generation and platform generation code so can modify parameters in json file (see code comments).

 

.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 licensing 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.

If you have any questions regarding the demo, post them to this thread and I will try to get you an answer.

cheers - shri

1 Comment
Gio

Thanks Shri, these demos are going to be really helpful to people that want to understand how wade's and box2d's physics APIs work.

Post a reply
Add Attachment
Submit Reply
Login to Reply