0

Basically i'd like to move a box2d body of a LHSprite that I created using LevelHelper. I have tried moving the box2d body of the LHSprite, based on weather my SneakyJoystick is active (that part works fine) with the following code:

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());
}

Can anyone see how I can get this working?

Thanks.

Harry
  • 321
  • 1
  • 5
  • 17

1 Answers1

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).

hawk
  • 1