目前我有这个代码可以发射射弹:
Vector3 d = mousePos.sub(pouchPos.x, pouchPos.y, 0);
d.mul(FIRE_SPEED);
projectile.setVelocity(-d.x, -d.y);
哪个工作正常,这根据鼠标位置设置位置:
turtle.body.setTransform(mousePos.x, mousePos.y, 0);
if (turtle.pos.dst(pouchPos) > 5)
{
//What to put in here?
}
麻烦是我不知道在if (turtle.pos.dst(pouchPos) > 5)
条款中放什么。你会建议什么?
答案 0 :(得分:0)
if ( length > limit )
vector.mul( limit / length );