0
嘿,我还有一个关于跳跃精灵身体的问题。在我的代码我使用moveLeft和MoveRight的按钮,当我按MoveRight的按钮使用如下代码雪碧身体不能停止
if (moveRight.active==YES)
{
b2Vec2 force=b2Vec2(4,0);
ballBody->SetLinearVelocity(force);
}
它当我发布这个按钮后,除精灵体停止使用下面的代码
else
{
b2Vec2 force=b2Vec2(0,0);
ballBody->SetLinearVelocity(force);
}
完全移动和但是当我把这个部分,然后跳转不能完成。我的跳码以下
if (jumpSprite.active==YES)
{
NSLog(@"Jump Sprite");
b2Vec2 locationWorld;
locationWorld=b2Vec2(0.0f,4.0f);
double force=ballBody->GetMass();
ballBody->ApplyLinearImpulse(force*locationWorld, ballBody->GetWorldCenter());
}
如果我删除其他部分则跳转会执行完成,但精灵的身体释放按钮后无法停止。
那该怎么办?
在此先感谢