0

I'm new to canvas and have an elementary knowledge of Javascript. I'm developing a (seemingly) simple game in which a ball rolls from the top left of the screen along a platform. image of ball

So the ball needs to have some kind of physics applied to it (I suppose) so that it not only moves from right to left but that is also has gravity and the ability to fall off the platform.

I am not sure how to achieve creating the platforms nor the ball physics. I realize this is an extremely general question - and I'm not asking someone to program this for me - but I just thought I'd poke around a little and see if someone can give me a good push in the right direction. I'm a little lost here.

Any help would be appreciated!

4

1 に答える 1

1

canvas 用の JavaScript 物理エンジンであるBox2DJSをご覧ください。これは、 Box2Dと呼ばれる非常に人気のある C++ 物理エンジンのポートです (より正確には、それ自体がオリジナルのポートであるActionScript 3.0バージョンのポートです)。

JavaScript 構文と ActionScript 構文は本質的に同じであるため、ActionScript 3.0 バージョン用のリソースがたくさんあります。JavaScript バージョンのデモもいくつかあります。このHello World デモには、開始するために必要なものがすべて含まれている可能性があります (右クリックしてソースを表示)。

于 2012-05-23T22:49:03.970 に答える