I want to make my character respawn in the last Checkpoint he has reached. I've already stored the position of the checkpoint but I'm not very sure of how to set that position to the Sprite/Body of the character to make it appear in the position I want to. Do I have to use the Sprite or the Body? Here's how I initialize my character:
mPlayerSprite = new AnimatedSprite(mapOffset, 0, playerTexture); final FixtureDef mPlayerFixtureDef = PhysicsFactory.createFixtureDef(0, 0f, 0f, false, CATEGORYBIT_PLAYER, MASKBITS_PLAYER, (short) 0); mPlayerBody = PhysicsFactory.createBoxBody(this.mPhysicsWorld, mPlayerSprite, BodyType.DynamicBody, mPlayerFixtureDef); mPlayerSprite.setUserData(playerName); mPlayerBody.setUserData(playerName); this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(mPlayerSprite, mPlayerBody, true, false)); mScene.attachChild(mPlayerSprite); mEntityList.add(mPlayerSprite);
Thanks in advance!