0

基本上我想移动我使用LevelHelper创建的 LHSprite 的 box2d 主体。我尝试根据天气移动 LHSprite 的 box2d 主体,我的 SneakyJoystick 处于活动状态(该部分工作正常),代码如下:

if(dpad.leftJoystick.velocity.x > 0){
    b2Vec2 force;
    force.Set(dpad.leftJoystick.velocity.x * 10.0f, 0.0f);
    Player.body->ApplyForce(force, Player.body->GetPosition());
}

谁能看到我怎样才能让它工作?

谢谢。

4

1 回答 1

0

LHSPrite has these methods: [sprite transformPosition:ccp(50,50)]; //will set the sprite position to 50,50 together with the physical body [sprite transformRotation:240];//will rotate the sprite to angle 240, together with the physical body

you have to update LHSPrite postitions bassed on box2d body in update method (see examples).

于 2013-02-22T17:42:29.200 回答