SHARE
TWEET
Untitled
a guest
Oct 18th, 2015
6
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- public void render() {
- Gdx.gl.glClearColor(0, 0, 0, 1);
- Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
- world.step(1/ 60f, 8, 3);
- camera.position.set(playerBody.getPosition().x, playerBody.getPosition().y, 0);
- camera.update();
- mapRenderer.render();
- mapRenderer.setView(camera);
- if (playermoving)
- movePlayer(); // linear velocity of player by +100 per .1 seconds
- batch.setProjectionMatrix(camera.combined);
- batch.begin();
- world.getBodies(tmpBodies);
- for(Body body : tmpBodies) { // loops through (10) bodies and if userdata is sprite then draw the sprite at body pos.
- if (body.getUserData() != null && body.getUserData() instanceof Sprite) {
- Sprite sprite = (Sprite) body.getUserData();
- sprite.setPosition(body.getPosition().x - sprite.getWidth() / 2, body.getPosition().y - sprite.getHeight() / 2);
- sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
- sprite.draw(batch);
- }
- }
- batch.end();
- box2DDebugRenderer.render(world, camera.combined);
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

