6 ms·
Make a simple HTML5 game using Box2d in JavaScript
- antirez 14y agoThis example is using box2d for something that can be implemented with very simple code dropping this important dependency IMHO. Box2d is a great fit when real 2D physics simulation is needed, but for apples falling at constant speed and jumps, it's not worth it.
- 1qaz2wsx3edc 14y agoThis example also has bugs. 1. Rapidly pressing up executes multiple jumps. 2. You can climb up the side of a block/group or just get stuck on it. Also the jump feels off.
- silv3r_m00n 14y agothe climbing on the side of the block is actually default box2d behaviour with bodies having friction. to make it slide off the side needed a bit of complex construction which i avoided to keep the tutorial simple.
- DanielRibeiro 14y agoThere is also this simple game using box2d in both Clojurescript[1] and Coffeescript[2], which can also help those starting with it. I wrote a little abut it[3]. [1] http://danielribeiro.github.com/ClojureCoffeeScriptGame/ http://danielribeiro.github.com/ClojureCoffeeScriptGame/ [2] http://danielribeiro.github.com/ClojureCoffeeScriptGame/clojure/physicsGame.html http://danielribeiro.github.com/ClojureCoffeeScriptGame/cloj... [3] http://metaphysicaldeveloper.wordpress.com/2011/08/28/clojurescript-vs-coffeescript/ http://metaphysicaldeveloper.wordpress.com/2011/08/28/clojur...
- silv3r_m00n 14y agoits for learning box2d, from the basics.
- Edmond 14y agohi, I did a manual box2d flash to js port sometime back, I used it to build this Sim: http://bit.ly/UOWq7D http://bit.ly/UOWq7D if you have an interest in building sims for education, explore APPynotebook:)
- jamesjporter 14y agoAnyone have other recommendations for HTML5 game tutorials? There's a simple card game I'd like to make so I've been itching to learn.
- jasonkester 14y agoI've been watching for a good Box2d javascript port for the last couple years, and so far there's nothing out there that's anywhere close to useable. It's a shame really, since the Flash version is so good. Every port is either a bunch of Regular expressions run against the ActionScript source, or a wacky hand port of a version several years out of date. In either case, as soon as you plug it into anything more complicated than the Hello World demos it starts demonstrating in myriad wacky ways that nobody must have ever tried using it on a real project. I keep checking back, doing the rounds of GitHub and the web in general every couple months hoping in vain that somebody will have put something good out, but thus far no luck. And of course, I'm part of the problem, complaining about the situation but not actually downloading the ActionScript source myself and putting together a decent port.
- a1k0n 14y agoHow about box2d via Emscripten? https://github.com/kripken/box2d.js/ https://github.com/kripken/box2d.js/ In general I agree with your assessment though.
- jasonkester 14y agoWow. Actual documentation and working examples. That jumps this one to the top of the pile for sure. Thanks for the link!