I have a problem, when i try to render textures. I read positions of gameObjects, for example coin and create box2d objects circle shape. I have wrote game logic and began make a graphic. But for some reason, textures drawing not in box2d objects, but they shifted to the right and up as mini-map in games.
batcher.begin(); sprite = new Sprite(AssetsLoader.coin); sprite.setPosition((body.getPosition().x - sprite.getWidth()/2), ((body.getPosition().y - sprite.getHeight()/2))); sprite.draw(batcher); batcher.end();
This is what happened
As you can see above, sprite position like body position. And something else: when i move my mainHero all rendered coins moving with him. On the screen they save their position, but in world they are moving. So how i can render coin texture exactly into box2d body.
May be something wrang with camera?
cam = new OrthographicCamera(); cam.setToOrtho(false, 400, 600);
or with Batcher?
batcher = new SpriteBatch(); batcher.setProjectionMatrix(world.getCamera().combined);
I will not give all my code, because it is big and no one will try to understand it.I need an idea or just an advice or a hint. Sorry for my English, hello everyone from Belarus :) Where do I look and what a start? Thank you.