0

我试图Motion在crafty.js 中使用该组件,但我在最基本的事情上失败了。似乎没有添加“运动”组件。

就像文档中示例代码中的这个非常简单的代码一样。

var ent = Crafty.e("2D, Motion");

var vel = ent.velocity(); //returns the velocity vector
vel.x;       // retrieve the velocity in the x direction
vel.x = 0;   // set the velocity in the x direction
vel.x += 4   // add to the velocity in the x direction

结果:TypeError: ent.velocity is not a function

我可以访问其他组件中的功能,比如MultivayText就好了。

4

0 回答 0